Skip empty test directories in gen_requirements_all (#62970)
This commit is contained in:
parent
4203e1b064
commit
ae3ff0a8ce
2 changed files with 6 additions and 15 deletions
|
@ -136,22 +136,12 @@ def has_tests(module: str):
|
|||
"""Test if a module has tests.
|
||||
|
||||
Module format: homeassistant.components.hue
|
||||
Test if exists: tests/components/hue
|
||||
Test if exists: tests/components/hue/__init__.py
|
||||
"""
|
||||
path = Path(module.replace(".", "/").replace("homeassistant", "tests"))
|
||||
if not path.exists():
|
||||
return False
|
||||
|
||||
if not path.is_dir():
|
||||
return True
|
||||
|
||||
# Dev environments might have stale directories around
|
||||
# from removed tests. Check for that.
|
||||
content = [f.name for f in path.glob("*")]
|
||||
|
||||
# Directories need to contain more than `__pycache__`
|
||||
# to exist in Git and so be seen by CI.
|
||||
return content != ["__pycache__"]
|
||||
path = (
|
||||
Path(module.replace(".", "/").replace("homeassistant", "tests")) / "__init__.py"
|
||||
)
|
||||
return path.exists()
|
||||
|
||||
|
||||
def explore_module(package, explore_children):
|
||||
|
|
1
tests/components/amberelectric/__init__.py
Normal file
1
tests/components/amberelectric/__init__.py
Normal file
|
@ -0,0 +1 @@
|
|||
"""Tests for the amberelectric integration."""
|
Loading…
Add table
Reference in a new issue