Skip to content

Commit 65e7e92

Browse files
author
EmbeddedOS Fix Bot
committed
test(ebuild): wave-3 smoke tests for every public module
- tests/ebuild/test_smoke_imports.py: import-smoke every public module (parameterized). Closes the ~93% module-coverage gap with a baseline that catches AttributeError + circular-import regressions.
1 parent 53b66a2 commit 65e7e92

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

tests/ebuild/test_smoke_imports.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""Smoke tests: import every public ebuild module.
2+
3+
This catches AttributeErrors, circular-import bugs, and refactor breakages
4+
before they reach production. Each import is independently tested so a
5+
single broken module does not mask the others.
6+
"""
7+
import importlib
8+
import pkgutil
9+
10+
import pytest
11+
12+
13+
PACKAGE = "ebuild"
14+
15+
16+
def _all_submodules(package_name: str):
17+
pkg = importlib.import_module(package_name)
18+
for m in pkgutil.walk_packages(pkg.__path__, prefix=f"{package_name}."):
19+
# Skip private + test packages
20+
if "._" in m.name or ".tests" in m.name:
21+
continue
22+
yield m.name
23+
24+
25+
@pytest.mark.parametrize("modname", list(_all_submodules(PACKAGE)))
26+
def test_import(modname):
27+
"""Every public ebuild module must import cleanly."""
28+
importlib.import_module(modname)

0 commit comments

Comments
 (0)