summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-10-30 16:47:54 -0400
committerNed Batchelder <ned@nedbatchelder.com>2021-10-30 16:47:54 -0400
commit40131f076c0784b331c6e0a5d8f88ff7b84b7296 (patch)
treedb9779b6ee573d505bcbfe99a8934c8494a4710e
parent17614733a798ab55310d46a41edb3a85d9815dee (diff)
downloadpython-coveragepy-git-40131f076c0784b331c6e0a5d8f88ff7b84b7296.tar.gz
debug: code we can enable to see where tests are running and in what order
-rw-r--r--tests/conftest.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/conftest.py b/tests/conftest.py
index d3fd1538..cef008c8 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -7,6 +7,7 @@ Pytest auto configuration.
This module is run automatically by pytest, to define and enable fixtures.
"""
+import os
import sys
import warnings
@@ -74,5 +75,12 @@ def reset_sys_path():
def pytest_runtest_call(item):
"""Convert StopEverything into skipped tests."""
outcome = yield
- if outcome.excinfo and issubclass(outcome.excinfo[0], StopEverything):
+ if outcome.excinfo and issubclass(outcome.excinfo[0], StopEverything): # pragma: only jython
pytest.skip(f"Skipping {item.nodeid} for StopEverything: {outcome.excinfo[1]}")
+
+ # For diagnosing test running:
+ if 0:
+ with open("/tmp/tests.txt", "a") as proctxt:
+ worker = os.environ.get('PYTEST_XDIST_WORKER', 'none')
+ test = os.environ.get("PYTEST_CURRENT_TEST", "unknown")
+ print(f"{worker}: {test}", file=proctxt, flush=True)