feat(testing.pytest): add subprocess decorator

This commit is contained in:
Tiara Rodney 2025-06-20 23:16:16 +02:00
parent 1ea3b3a24d
commit 43cdf21d4b
No known key found for this signature in database
GPG key ID: 5F43FAB4FBE5B5EB
6 changed files with 122 additions and 3 deletions

View file

@ -0,0 +1,14 @@
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