mirror of
https://git.zavage.net/Zavage-Software/smileyface.git
synced 2026-06-25 18:12:48 -06:00
test: add import smoke test (reveals undeclared selenium dep)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
ccd7f2793f
commit
f021f1c1b0
@ -32,6 +32,7 @@ black = "*"
|
|||||||
pre-commit = "*"
|
pre-commit = "*"
|
||||||
isort = "*"
|
isort = "*"
|
||||||
flake8 = "*"
|
flake8 = "*"
|
||||||
|
pytest = "*"
|
||||||
#Sphinx = "^5.3.0"
|
#Sphinx = "^5.3.0"
|
||||||
#sphinx-rtd-theme = "^1.3.0"
|
#sphinx-rtd-theme = "^1.3.0"
|
||||||
|
|
||||||
@ -49,3 +50,7 @@ combine_as_imports = true
|
|||||||
include_trailing_comma = true
|
include_trailing_comma = true
|
||||||
force_grid_wrap = 3
|
force_grid_wrap = 3
|
||||||
ensure_newline_before_comments = true
|
ensure_newline_before_comments = true
|
||||||
|
|
||||||
|
[tool.pytest.ini_options]
|
||||||
|
testpaths = ["tests"]
|
||||||
|
addopts = "-ra"
|
||||||
|
|||||||
32
tests/test_imports.py
Normal file
32
tests/test_imports.py
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
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,
|
||||||
|
)
|
||||||
|
]
|
||||||
|
|
||||||
|
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)
|
||||||
Loading…
Reference in New Issue
Block a user