2026-06-10 22:31:18 +02:00
|
|
|
"""Tests for the package entry points (__init__, __main__).
|
|
|
|
|
|
|
|
|
|
Importing ``__main__`` executes its module-level code (the ``if __name__`` guard
|
|
|
|
|
is excluded from coverage), wiring the ``python -m`` entry point under test.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
import importlib
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_main_module_imports() -> None:
|
2026-06-22 12:18:39 +02:00
|
|
|
"""The ``python -m diet_guard`` entry module imports cleanly."""
|
|
|
|
|
module = importlib.import_module("diet_guard.__main__")
|
2026-06-10 22:31:18 +02:00
|
|
|
assert hasattr(module, "main")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_package_imports() -> None:
|
|
|
|
|
"""The package itself imports without side effects."""
|
2026-06-22 12:18:39 +02:00
|
|
|
package = importlib.import_module("diet_guard")
|
2026-06-10 22:31:18 +02:00
|
|
|
assert package is not None
|