From aab6c32ca0fb290da7d31aaad9a6e9893240be26 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sat, 16 Oct 2021 07:41:53 -0400 Subject: test: subprocess diagnostic for when we need it --- tests/helpers.py | 6 ++++++ 1 file changed, 6 insertions(+) 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. -- cgit v1.2.1