-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
--pdb causes stderr/stdout output to be hidden #1223
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
I think here's the line with the problem... |
Thanks for the quick reply, looks like you're right, it should instead be doing something like;
@nicoddemus I think that stdout/stderr should probably be printed /before/ pdb gets called, would you agree? |
For correct output you need to obtain the terminal writer plugin, like settrace does for example |
@RonnyPfannschmidt Sorry I'm not quite following, are you saying this is a code bug or user error? |
@foxx I think Ronny meant about the code you posted, that you should use the terminal writer plugin instead of writing directly to |
Exactly, thanks for the clarification |
@foxx any chance of opening a PR with this fix? 😁 |
Just tried getting this to work locally, but can't seem to figure it out.
This is an almost exact copy of what is being done with
There's a lot of monkeypatching and magic in here that I don't really understand, I could probably figure it out but it would take me 7396749373 times longer than others with an understanding of the internals. If someone can give me a pointer in the right direction then I'll happily try again |
I've also tried calling
Although |
I would suggest to dig directly into the pytest's source instead of trying to muck around with the plugins. I think it would be just a matter of changing the code around this line to something like this (untested): def pytest_exception_interact(self, node, call, report):
capman = node.config.pluginmanager.getplugin("capturemanager")
if capman:
out, err = capman.suspendcapture(in_=True)
sys.stdout.write(out)
sys.stdout.write(err)
_enter_pdb(node, call.excinfo, report) I would leave out trying to use |
Yeah that works much better, I would have done this before but was stuck trying to make |
For some reason, if I specify
--pdb
, the stdout/stderr capture output doesn't get printed, neither before or after thepdb
shell.Here are the steps to reproduce.
Test file
Without PDB
With PDB
The text was updated successfully, but these errors were encountered: