feat(testing.pytest): add subprocess decorator
This commit is contained in:
parent
1ea3b3a24d
commit
43cdf21d4b
6 changed files with 122 additions and 3 deletions
14
src/byteb4rb1e/utils/testing/pytest/__init__.py
Normal file
14
src/byteb4rb1e/utils/testing/pytest/__init__.py
Normal 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
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue