mirror of
https://github.com/esphome/esphome.git
synced 2026-09-23 21:14:03 +00:00
Address review: decorator anchored guard, validated stamp path, max mtime age probe, stray file reclaim
This commit is contained in:
+2
-1
@@ -1105,6 +1105,7 @@ def get_components_per_integration_fixture() -> dict[str, set[str]]:
|
||||
|
||||
_TEST_FUNC_RE = re.compile(r"async def (test_\w+)")
|
||||
_SHARED_YAML_RE = re.compile(r"@pytest\.mark\.shared_yaml\([\"'](\w+)[\"']\)")
|
||||
_SHARED_YAML_DECORATOR_RE = re.compile(r"@pytest\.mark\.shared_yaml\(")
|
||||
|
||||
|
||||
@cache
|
||||
@@ -1126,7 +1127,7 @@ def get_fixture_to_test_files() -> dict[str, frozenset[str]]:
|
||||
result.setdefault(base_name, set()).add(rel_path)
|
||||
# Shared fixtures are named by marker, not by a test function
|
||||
names = _SHARED_YAML_RE.findall(content)
|
||||
if len(names) != content.count("pytest.mark.shared_yaml("):
|
||||
if len(names) != len(_SHARED_YAML_DECORATOR_RE.findall(content)):
|
||||
# A wrapped or non-literal marker would silently drop the mapping
|
||||
# and CI would select no tests for that fixture
|
||||
raise ValueError(
|
||||
|
||||
Reference in New Issue
Block a user