Support context-aware subprocess tracking in tests

This commit is contained in:
aliowka 2026-06-17 19:36:51 +03:00
parent 086b1e4c31
commit c722ad8d59
2 changed files with 16 additions and 0 deletions

View File

@ -161,3 +161,9 @@ def pytest_runtest_setup(item):
# Generate localhost certificate files, needed by some tests
generate_keys()
@pytest.hookimpl(tryfirst=True)
def pytest_runtest_setup(item):
import os
os.environ["DELTA_TEST_NAME"] = item.nodeid

View File

@ -1,2 +1,12 @@
import os
import coverage
# Start coverage first as configured
coverage.process_startup()
# If started, set the context to the active test name
cov = coverage.Coverage.current()
if cov:
test_name = os.environ.get("DELTA_TEST_NAME")
if test_name:
cov.switch_context(test_name)