-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
python -m test --coverage doesn't work on Windows #69447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
"python -m test --coverage" doesn't work on Windows because the tracer ignores the root directory of Python source code. The code works on Linux because sys.base_prefix and sys.base_exec_prefix don't point to the Python source code, but to /usr/local. I'm not sure why sys.base_prefix and sys.base_exec_prefix are ignored. |
I added a new test for "-m test --coverage" in test_regrtest, but I skipped the test on Windows. |
What version of coverage.py is this? |
Changes on ignoredirs: Changeset 294f8aeb4d4b: "Implemented PEP-405 (Python virtual environments)." - tracer = trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix, libpath],
- trace=0, count=1)
+ tracer = trace.Trace(ignoredirs=[sys.base_prefix, sys.base_exec_prefix,
+ libpath], trace=0, count=1) Changeset b43f14c103bb: "bpo-5656: detect correct encoding of files when reporting coverage in trace.py, and ignore files in the temporary direct" - import trace
- tracer = trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix],
+ import trace, tempfile
+ tracer = trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix,
+ tempfile.gettempdir()], Changeset 308c193f51e3: "adds -T option for code coverage. The implementation is a fairly simpleminded adaptation of Zope3's test.py -T flag." + tracer = trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix], |
Ooops, copy/paste failure. The right diff is: Changeset 294f8aeb4d4b: "Implemented PEP-405 (Python virtual environments)." - tracer = trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix,
+ tracer = trace.Trace(ignoredirs=[sys.base_prefix, sys.base_exec_prefix,
tempfile.gettempdir()],
trace=False, count=True) |
Attached patch simply removes the list of ignored directories. It fixes test_regrtest.test_coverage() on Windows. |
New changeset 0f10e0b3e76d by Victor Stinner in branch 'default': |
Ok, I fixed the issue by removing the list of ignored directories. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: