summaryrefslogtreecommitdiff
path: root/tests/test_execfile.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-08-09 16:24:10 -0400
committerNed Batchelder <ned@nedbatchelder.com>2021-08-09 16:24:10 -0400
commitf5621baca33e193f03286acf998a92ac67f3b723 (patch)
tree7ed944414ac6ff8eb849133cafa7777e3fbd34b9 /tests/test_execfile.py
parent15945f2408efaf164a3a78f67ef74a74d557fa82 (diff)
downloadpython-coveragepy-git-f5621baca33e193f03286acf998a92ac67f3b723.tar.gz
test: simplify pyc logic
The old pycache_prefix logic was because we would run tests in Docker containers, and they went faster if we set PYTHONCACHEPREFIX. But we don't do that anymore, so we can use simpler code.
Diffstat (limited to 'tests/test_execfile.py')
-rw-r--r--tests/test_execfile.py11
1 files changed, 2 insertions, 9 deletions
diff --git a/tests/test_execfile.py b/tests/test_execfile.py
index dcd03b44..fe02f5fe 100644
--- a/tests/test_execfile.py
+++ b/tests/test_execfile.py
@@ -8,6 +8,7 @@ import fnmatch
import json
import os
import os.path
+import pathlib
import re
import sys
@@ -121,15 +122,7 @@ class RunPycFileTest(CoverageTest):
os.remove("compiled.py")
# Find the .pyc file!
- roots = ["."]
- prefix = getattr(sys, "pycache_prefix", None)
- if prefix:
- roots.append(prefix)
- for root in roots: # pragma: part covered
- for there, _, files in os.walk(root): # pragma: part covered
- for fname in files:
- if fnmatch.fnmatch(fname, "compiled*.pyc"):
- return os.path.join(there, fname)
+ return str(next(pathlib.Path(".").rglob("compiled*.pyc")))
def test_running_pyc(self):
pycfile = self.make_pyc()