-
-
Notifications
You must be signed in to change notification settings - Fork 448
Coverage causes test to fail with pexpect and pdb.set_trace
.
#1402
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
Hmm, this is because of 4b592fe#diff-68a483552b5cf650f43e371e28ef86ba13f3958e93bc1587c3cb7afad0397f24R517, which was done to get a slight performance improvement. I guess there isn't a way to keep it? |
CPython has an open issue to set the flag when using bdb: python/cpython#80675 |
Maybe this question was rhetorical 😅, but if not, I want to mention that I cannot judge whether the changes justify breaking some code -- probably not many people are affected?. Of course, it would be more convenient for me if you would revert the patch. Still, the alternatives are only minor nuisances one can quickly work around (pinning coverage, verifying it locally, etc.). Would the changes to CPython be backported to 3.7 and the other versions, or would it only affect 3.10 and 3.11? |
Hi,
First of all, thanks for the great library!
Describe the bug
I have a test that spawns a child process with pexpect and runs my application. Then, it checks whether some output is displayed and interacts with the program in the child process. The test looks like this.
You can think of the task function defined in the string as a test function from pytest. Like pytest, my program would also stop at
pdb.set_trace
and allow the user to debug the function.When I run the test with the
--cov
option from pytest-cov and coverage==6.4.1, the test fails after the statement withpdb.set_trace
on Ubuntu and macOS. It seems like the contenti == 1
is not displayed in the child process, but it is hard to tell since pexpect is hard to debug.The test succeeds when I remove the
--cov
option. The test is also OK on Ubuntu and MacOS with coverage<=6.4.0.To Reproduce
I reproduced and fixed the error by pinning coverage in pytask-dev/pytask#283.
environment.yml
. (If it helps reproduce the bug, I can add a requirement.txt.)pytest tests/test_debugging.py --cov=src
.Expected behavior
The tests should run fine as before.
Additional context
Since my package is a fork of pytest and very similar regarding this feature, I would not be surprised if they encounter the same issue. I saw some failing jobs in their PRs, which seem to have the same problem: https://github.com/pytest-dev/pytest/runs/6852766697?check_suite_focus=true#step:6:201.
The text was updated successfully, but these errors were encountered: