Skip empty test directories in gen_requirements_all (#62970)

This commit is contained in:
Matt Zimmerman 2022-01-07 07:45:27 -08:00 committed by GitHub
parent 4203e1b064
commit ae3ff0a8ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 15 deletions

View file

@ -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):

View file

@ -0,0 +1 @@
"""Tests for the amberelectric integration."""