14 lines
434 B
Python
14 lines
434 B
Python
import os
|
|
from pathlib import Path
|
|
from typing import Tuple
|
|
|
|
|
|
def get_current_test() -> Tuple[Path, str]:
|
|
current_test_env = os.getenv("PYTEST_CURRENT_TEST")
|
|
if current_test_env is None:
|
|
raise RuntimeError("PYTEST_CURRENT_TEST not set. Must be run under pytest.")
|
|
|
|
suite_path, case_name = current_test_env.split('::', 1)
|
|
case_name = case_name.split(' ', 1)[0]
|
|
return Path(suite_path).resolve(), case_name
|
|
|