Exclude gold and platinum integrations from .coveragerc (#117563)

This commit is contained in:
epenet 2024-05-24 16:10:22 +02:00 committed by GitHub
parent a8fba691ee
commit 6a10e89f6d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 1 deletions

View File

@ -729,7 +729,6 @@ omit =
homeassistant/components/lookin/sensor.py
homeassistant/components/loqed/sensor.py
homeassistant/components/luci/device_tracker.py
homeassistant/components/luftdaten/sensor.py
homeassistant/components/lupusec/__init__.py
homeassistant/components/lupusec/alarm_control_panel.py
homeassistant/components/lupusec/binary_sensor.py

View File

@ -19,6 +19,7 @@ DONT_IGNORE = (
"recorder.py",
"scene.py",
)
FORCE_COVERAGE = ("gold", "platinum")
CORE_PREFIX = """# Sorted by hassfest.
#
@ -105,6 +106,14 @@ def validate(integrations: dict[str, Integration], config: Config) -> None:
integration = integrations[integration_path.name]
if integration.quality_scale in FORCE_COVERAGE:
integration.add_error(
"coverage",
f"has quality scale {integration.quality_scale} and "
"should not be present in .coveragerc file",
)
continue
if (last_part := path.parts[-1]) in {"*", "const.py"} and Path(
f"tests/components/{integration.domain}/__init__.py"
).exists():
@ -112,6 +121,7 @@ def validate(integrations: dict[str, Integration], config: Config) -> None:
"coverage",
f"has tests and should not use {last_part} in .coveragerc file",
)
continue
for check in DONT_IGNORE:
if path.parts[-1] not in {"*", check}: