diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2021-11-21 08:39:01 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2021-11-21 08:39:01 -0500 |
commit | 57768ee130fe2b0e7d1b27399ff2c73aa1cdbfe3 (patch) | |
tree | 679766d99607c0a2ca66ac06326ec4a010a96964 /tests/conftest.py | |
parent | 0922240cfb5e549a83f56a12629a16ad3fe2b498 (diff) | |
download | python-coveragepy-git-57768ee130fe2b0e7d1b27399ff2c73aa1cdbfe3.tar.gz |
test(fix): never delete the pth file
Diffstat (limited to 'tests/conftest.py')
-rw-r--r-- | tests/conftest.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/conftest.py b/tests/conftest.py index 1bf37298..6d69fb20 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -184,10 +184,12 @@ def create_pth_file(): """Create a .pth file for measuring subprocess coverage.""" pth_dir = find_writable_pth_directory() assert pth_dir - pth_path = os.path.join(pth_dir, f"subcover_{WORKER}.pth") - with open(pth_path, "w") as pth: - pth.write("import coverage; coverage.process_startup()\n") + pth_path = os.path.join(pth_dir, "subcover.pth") + if not os.path.exists(pth_path): + with open(pth_path, "w") as pth: + pth.write("import coverage; coverage.process_startup()\n") yield - os.remove(pth_path) + # We leave the pth file in place. This seems not-great, but deleting it + # seems to always cause problems among the test workers. |