summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-10-16 07:41:53 -0400
committerNed Batchelder <ned@nedbatchelder.com>2021-10-16 08:02:45 -0400
commitaab6c32ca0fb290da7d31aaad9a6e9893240be26 (patch)
treec8318bcec4966baef1eb95a41faff6abc7d9bb87
parente4c3d3007bce562f1fbdc2d2029a4bcbeaf8cd08 (diff)
downloadpython-coveragepy-git-aab6c32ca0fb290da7d31aaad9a6e9893240be26.tar.gz
test: subprocess diagnostic for when we need it
-rw-r--r--tests/helpers.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/helpers.py b/tests/helpers.py
index c85a36cb..1420bed7 100644
--- a/tests/helpers.py
+++ b/tests/helpers.py
@@ -24,6 +24,12 @@ def run_command(cmd):
Returns the exit status code and the combined stdout and stderr.
"""
+ # Subprocesses are expensive, but convenient, and so may be over-used in
+ # the test suite. Use these lines to get a list of the tests using them:
+ if 0: # pragma: debugging
+ with open("/tmp/processes.txt", "a") as proctxt:
+ print(os.environ.get("PYTEST_CURRENT_TEST", "unknown"), file=proctxt, flush=True)
+
# In some strange cases (PyPy3 in a virtualenv!?) the stdout encoding of
# the subprocess is set incorrectly to ascii. Use an environment variable
# to force the encoding to be the same as ours.