From 4b2557911953692b5a7c560014d06d37b803839e Mon Sep 17 00:00:00 2001 From: razinkele Date: Sun, 4 Jan 2026 22:16:44 +0200 Subject: [PATCH] test: add smoke test importing app.app and app.logger to catch import-time issues --- tests/test_app_import.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tests/test_app_import.py diff --git a/tests/test_app_import.py b/tests/test_app_import.py new file mode 100644 index 0000000..1abd5b8 --- /dev/null +++ b/tests/test_app_import.py @@ -0,0 +1,28 @@ +"""Smoke tests to catch import-time errors for the Shiny app package. + +These tests intentionally import `app.app` and `app.logger` to ensure the +package is importable in different execution contexts (package vs script). +""" +from pathlib import Path +import importlib +import sys + + +def _ensure_repo_on_path(): + repo_root = Path(__file__).resolve().parents[1] + if str(repo_root) not in sys.path: + sys.path.insert(0, str(repo_root)) + + +def test_import_app_module(): + """Import the app module and ensure `app` object exists.""" + _ensure_repo_on_path() + mod = importlib.import_module("app.app") + assert hasattr(mod, "app"), "`app.app` must export `app`" + + +def test_import_logger_module(): + """Import the logging helper module to catch syntax/runtime import errors.""" + _ensure_repo_on_path() + mod = importlib.import_module("app.logger") + assert hasattr(mod, "logger"), "`app.logger` must export `logger`"