deltaforge-real-time-cross-.../tests/test_demo.py

29 lines
962 B
Python

import pytest
import sys
import os
# Robust import in case pytest runs with a constrained PYTHONPATH
try:
from deltaforge_mvp.demo import main
except Exception:
# Fallback: load module directly from repo path
import importlib.util
import pathlib
repo_root = pathlib.Path(__file__).parents[1].resolve()
# Ensure repo root is on sys.path for dynamic import fallback
if str(repo_root) not in sys.path:
sys.path.insert(0, str(repo_root))
demo_path = repo_root / 'deltaforge_mvp' / 'demo.py'
spec = importlib.util.spec_from_file_location("deltaforge_mvp.demo", str(demo_path))
if spec is None or spec.loader is None:
raise ImportError("Could not load deltaforge_mvp.demo fallback module")
mod = importlib.util.module_from_spec(spec)
spec.loader.exec_module(mod) # type: ignore
main = mod.main
def test_demo_runs():
# Ensure the demo runs without raising
ret = main()
assert ret == 0