import importlib.util from pathlib import Path path = Path(__file__).with_name("test_core.py") spec = importlib.util.spec_from_file_location("test_core", path) module = importlib.util.module_from_spec(spec) assert spec.loader spec.loader.exec_module(module) for name in sorted(x for x in vars(module) if x.startswith("test_")): getattr(module, name)() print(f"{name}=PASS")