diff --git a/script/gen_requirements_all.py b/script/gen_requirements_all.py index 02ef8d929da..117e5230c52 100755 --- a/script/gen_requirements_all.py +++ b/script/gen_requirements_all.py @@ -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): diff --git a/tests/components/amberelectric/__init__.py b/tests/components/amberelectric/__init__.py new file mode 100644 index 00000000000..9eae18c65aa --- /dev/null +++ b/tests/components/amberelectric/__init__.py @@ -0,0 +1 @@ +"""Tests for the amberelectric integration."""