Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Possible regression of pdb suppressing output #3052
Hey guys, /cc @nicoddemus
Approx two years ago I submitted a patch for
I can see the PR was merged and the appropriate test is present in master;
But when trying to use this myself, it doesn't seem to work, as seen below.
Any thoughts why this would pass unit tests, but wouldn't work in latest release?
I started debugging this, and I don't yet know why the behavior broke, but I know why the test still passes. The test expects to find the text "getrekt" in the output:
It indeed exists, just not as a result of the print statement, rather in the traceback of the assertion failure:
A possible solution is to update the print in the test to the following:
... and the regex to the following:
Now the test does indeed fail, but passes if I add
I found the problem, but from the looks of the code it appears to be intentional. The reports, including the captured call stdout, are explicitly not printed when pdb has been shown.
I looked over your original PR, and it doesn't look like the correct way to do what you wanted. I'm guessing it happened to work at the time but subsequent changes (understandably) broke it.
Hey @brianmaissy thanks for looking into this, glad to know I'm not going crazy! Curious, any idea why they are forcibly removed? Is there a flag which will enable them to be outputted? In the event of pdb being triggered, it's surely important to be able to see the context of why it's been triggered, even if it's an optional flag?
Hey guys sorry for the delay, this got lost in my TODO list.
I'm not entirely sure how this all work together and I have to leave for now, but perhaps someone can test if changing
In the test in question, we are entering through
The output is indeed getting captured, and not thrown away. The problem is that it is saved in the test report (in
If I comment out the
But in this case it does seem relevant to print the output before entering the debugger. The question is how do we get at the output which was already saved into the test report?
Maybe adding the lines:
on line 89 of debugging.py, in