-
-
Notifications
You must be signed in to change notification settings - Fork 429
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
os.path.relpath fails when saving a coverage file with coverage 5 in a folder from a different Windows drive #895
Comments
Ironically, the relpath line in question is only there to help with a different Windows problem. Perhaps catching a ValueError from relpath, and skipping it will be enough? |
Will do this. |
Done in #896. |
Fixed in c09c2c2 |
awesome -- thanks for the triage and fix on this! this is affecting pytest's testsuite as well (it was quite a bit harder to track down in python3 as the stacktrace doesn't mention coverage at all! fortunately our maintenance branch showed the failures in python2) for completeness (and perhaps so others can find in google), here are the traces we saw: 2.x
3.x
|
Why the Python 3 traceback is a mystery to me. I also wasted some time debugging at random because of this. Anybody has an idea why it is the case? |
Maybe the frame objects have already been garbage collected? That seems weird. |
I've ran into this with virtualenv CI too - see https://dev.azure.com/pypa/virtualenv/_build/results?buildId=16409&view=logs&jobId=18fdbe60-1f00-5bb0-ebb2-c0f5cf5b2053&j=6ae96b06-827a-58da-753b-f69475679149&t=1bc2b072-5378-5303-372a-95d81e0bbf25; any planned release with a fix? |
Fixed in c09c2c2 |
This is now available in coverage==5.0.1 |
coverage 5.0.1 was released with a fix for: nedbat/coveragepy#895
Describe the bug
In the scikit-learn test suite we have a test that launches a subprocess and the atexit registry triggers the saving of a coverage file in a tempfolder in d:\ while the current working directory has been changed by
pytest --pyargs
to c:\ in the meantime.I do not understand why the traceback starts at
atexit._run_exitfuncs
and then goes tontpath.relpath
directly without going through the function of thecoverage
module. I suspect that the culprit is:https://github.com/nedbat/coveragepy/blob/coverage-5.0/coverage/sqldata.py#L982
When rolling back to coverage 4.5.3, the problem disappears.
To Reproduce
This problems happens with coverage 5.0 and Python 3.7.5 with the latest pytest and pytest-cov.
It seems tricky to reproduce, in particular I do not understand why this only happens in the subprocess tests of scikit-learn and never in the main process itself. Maybe the current working directory is restored to the d:\ tempfolder prior to writing the coverage files?
Anyhow the details can be found in the CI logs of this pull request where I have patched the
ntpath.relpath
function to display more debug info:scikit-learn/scikit-learn#15909
I will open a PR to fix the issue in coveragepy.
It looks similar to #824 but the error message is actually different.
The text was updated successfully, but these errors were encountered: