mirror of
https://github.com/home-assistant/core.git
synced 2026-08-24 10:13:52 -05:00
Detect .start entry point files in hassfest check (#169135)
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user