22 lines
613 B
Python
22 lines
613 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_parser.py"
|
|
SPEC = importlib.util.spec_from_file_location("ecospecies_api_test_parser", 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)
|