EcoSpecies-Atlas/apps/api/test_repository.py

22 lines
621 B
Python

from __future__ import annotations
import importlib.util
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parent
SRC = ROOT / "src"
if str(SRC) not in sys.path:
sys.path.insert(0, str(SRC))
TEST_PATH = ROOT / "tests" / "test_repository.py"
SPEC = importlib.util.spec_from_file_location("ecospecies_api_test_repository", TEST_PATH)
MODULE = importlib.util.module_from_spec(SPEC)
assert SPEC is not None and SPEC.loader is not None
SPEC.loader.exec_module(MODULE)
for name in dir(MODULE):
if name.startswith("Test") or name.endswith("Tests"):
globals()[name] = getattr(MODULE, name)