Detect .start entry point files in hassfest check (#169135)

This commit is contained in:
Marc Mueller
2026-04-25 23:55:47 +02:00
committed by GitHub
parent e9ca9254df
commit c1894eda83
2 changed files with 9 additions and 3 deletions
+1 -1
View File
@@ -729,7 +729,7 @@ def check_dependency_files(
if not (top := file.parts[0].lower()).endswith((".dist-info", ".py")):
top_level.add(top)
if (name := str(file).lower()) in FORBIDDEN_FILE_NAMES or (
name.endswith(".pth") and len(file.parts) == 1
name.endswith((".pth", ".start")) and len(file.parts) == 1
):
file_names.add(str(file))
results = _PackageFilesCheckResult(
+8 -2
View File
@@ -276,6 +276,7 @@ def test_check_dependency_file_names(integration: Integration) -> None:
PackagePath("py.typed"),
PackagePath("my_package.py"),
PackagePath("some_script.Pth"),
PackagePath("entry_point.start"),
PackagePath("my_package-1.0.0.dist-info/METADATA"),
]
with (
@@ -289,20 +290,25 @@ def test_check_dependency_file_names(integration: Integration) -> None:
assert _packages_checked_files_cache[pkg]["file_names"] == {
"py.typed",
"some_script.Pth",
"entry_point.start",
}
assert len(integration.errors) == 2
assert len(integration.errors) == 3
assert f"Package {pkg} has a forbidden file 'py.typed' in {package}" in [
x.error for x in integration.errors
]
assert f"Package {pkg} has a forbidden file 'some_script.Pth' in {package}" in [
x.error for x in integration.errors
]
assert (
f"Package {pkg} has a forbidden file 'entry_point.start' in {package}"
in [x.error for x in integration.errors]
)
integration.errors.clear()
# Repeated call should use cache
assert check_dependency_files(integration, package, pkg, ()) is False
assert mock_files.call_count == 1
assert len(integration.errors) == 2
assert len(integration.errors) == 3
integration.errors.clear()
# All good