-
Notifications
You must be signed in to change notification settings - Fork 213
Coverage report generation incompatible with pytest tmpdir
feature
#234
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
Sounds like it. I assume it gets written to some temporary directory maybe (outside of with you run |
Is |
Yes the
This at least creates the I haven't gotten much out of exporting |
The command should be
What options are you using? |
btw: it is probably better to look at pytest-cov's code, where it handles the html report - i.e. put a |
Ah yes, this generates the output just fine.
What I did was just |
coverage.py is https://github.com/nedbat/coveragepy/ The environment variable is |
Debugging in this line showed that
So the question is: What is the nicest way to recover the working directory? Just store it initially and |
tmpdir
feature
Are you changing the directory yourself? |
I assume pytest-cov could make the path absolute to the session's initial cwd maybe, and/or write the report with changing the dir itself temporarily (to the initial dir). |
pytest itself has problems with this during collection already btw (pytest-dev/pytest#4317). |
Yes it turned out there was a test which sets the working directory manually. |
We could try to make sure we dump the report in the original cwd tho (just like we handle config paths). |
There is |
Check the new examples from #267 - they should clarify how to correctly use pytest-cov in your project. |
I also ran into the same issue recently where I couldn't chdir into pytest's
This will cleanly revert the current working directory to the previous directory before |
Given a project structure like:
I'm running the command in the toplevel
myproject
directory:On stdout I can see the log output:
However no output has been written, i.e., the
myproject
directory does not containhtmlcov
(and neither of its subdirectories). Even afind / -name "*htmlcov*"
reveals nothing.Notes:
--cov-report html:/absolute/path/to/myproject/htmlcov
.--cov-report xml
.chdir
a lot -- can this mess up pytest-cov?Versions:
The text was updated successfully, but these errors were encountered: