mirror of
https://git.zavage.net/Zavage-Software/smileyface.git
synced 2026-06-25 18:12:48 -06:00
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
35 lines
863 B
Python
35 lines
863 B
Python
import importlib
|
|
import pkgutil
|
|
|
|
import smileyface
|
|
|
|
|
|
def test_top_level_package_imports():
|
|
importlib.import_module("smileyface")
|
|
|
|
|
|
def test_all_submodules_import():
|
|
errors = []
|
|
|
|
def _on_walk_error(name):
|
|
errors.append(f"{name}: failed during package walk")
|
|
|
|
module_names = [
|
|
info.name
|
|
for info in pkgutil.walk_packages(
|
|
smileyface.__path__,
|
|
prefix="smileyface.",
|
|
onerror=_on_walk_error,
|
|
)
|
|
]
|
|
|
|
assert module_names, "walk_packages found no submodules - check smileyface.__path__"
|
|
|
|
for name in module_names:
|
|
try:
|
|
importlib.import_module(name)
|
|
except Exception as exc: # noqa: BLE001 - we want every failure, not the first
|
|
errors.append(f"{name}: {exc!r}")
|
|
|
|
assert not errors, "Modules failed to import:\n" + "\n".join(errors)
|