You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Automatically stop console output capturing when pudb is used #647
status: help wanteddevelopers would like help from experts on this topictype: bugproblem that needs to be addressedtype: enhancementnew feature or API change, should be merged into features branch
Originally reported by: BitBucket: vmalloc, GitHub: vmalloc
Currently py.test correctly identifies when pdb kicks in and temporarily stops output capturing. This also works for ipdb AFAIK. When trying to use pudb to debug or set_trace in running code, the output capturing is not turned off, thus causing an error. It would be nice for pudb to be recognized as well.
Original comment byholger krekel (BitBucket: hpk42, GitHub: hpk42):
if you can please try to contribute a PR which makes pudb work (_pytest/pdb.py and testing/test_pdb.py are the relevant files i guess, maybe _pytest/capture.py as well)
if pudb.set_trace() is called from a test function, pytest should set the options -s --capture=no.
Or at least elicit a warning indicating the user would want these command line switches to make pudb work.
If I had learned about these switches earlier, I would have used pudb earlier — which I sincerely wished! I consider this to be essential.
If nothing seems reasonable, a mention in the doc would be highly appreciated.
@benjaminweb pdb is explicitly supported since its in the stdlib - other debuggers added support code for pytest (pdbpp), or pytest plugins where written (pytest-ipdb) for example
also pytest supports declaring a pdb class, in which case pytest.set_trace is invoked does the pytest support and defers the rest to the actual debugger
also the cli options are unrelated to debugger integration, using those just makes it easier to use unsupported tools
a integrated debugger disables capture while debugging and then re-enables it
@RonnyPfannschmidt so, the lacking pudb integration is due to that pudb seems not to declare a pdb class? can we verify this and delegate the issue if applicable to them? Ah, I see there is already an issue pending: inducer/pudb#221
What needs to be done to get the implementation with pytest right?
The current approach still seems to require the -s switch: inducer/pudb#224
inducer/pudb#224 just concerns passing on exceptions correctly. I haven't tested debug-on-test-fail with pytest and pudb, so I don't know whether it works as intended. (Although I am a heavy user of pytest, so thank you!)
status: help wanteddevelopers would like help from experts on this topictype: bugproblem that needs to be addressedtype: enhancementnew feature or API change, should be merged into features branch
Activity
pytestbot commentedon Dec 21, 2014
Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42):
if you can please try to contribute a PR which makes pudb work (
_pytest/pdb.pyandtesting/test_pdb.pyare the relevant files i guess, maybe_pytest/capture.pyas well)RonnyPfannschmidt commentedon Jan 1, 2016
Closing as stalled
benjaminweb commentedon Jan 22, 2018
if
pudb.set_trace()is called from a test function, pytest should set the options-s --capture=no.Or at least elicit a warning indicating the user would want these command line switches to make pudb work.
If I had learned about these switches earlier, I would have used pudb earlier — which I sincerely wished! I consider this to be essential.
If nothing seems reasonable, a mention in the doc would be highly appreciated.
RonnyPfannschmidt commentedon Jan 22, 2018
@benjaminweb pdb is explicitly supported since its in the stdlib - other debuggers added support code for pytest (pdbpp), or pytest plugins where written (pytest-ipdb) for example
also pytest supports declaring a pdb class, in which case pytest.set_trace is invoked does the pytest support and defers the rest to the actual debugger
also the cli options are unrelated to debugger integration, using those just makes it easier to use unsupported tools
a integrated debugger disables capture while debugging and then re-enables it
twmr commentedon Jan 22, 2018
@RonnyPfannschmidt is the pytest pdb class stuff mentioned in the docs somewhere? I've only found https://docs.pytest.org/en/latest/usage.html#setting-breakpoints, which only mentions the stdlib pdb module.
benjaminweb commentedon Jan 22, 2018
pytest-ipdb is no longer maintained.
@RonnyPfannschmidt so, the lacking pudb integration is due to that pudb seems not to declare a pdb class? can we verify this and delegate the issue if applicable to them? Ah, I see there is already an issue pending: inducer/pudb#221
What needs to be done to get the implementation with pytest right?
The current approach still seems to require the
-sswitch: inducer/pudb#224nicoddemus commentedon Jan 22, 2018
@Thisch indeed the
--pdbclsoption is not mentioned anywhere in the docs, created #3141.nicoddemus commentedon Jan 22, 2018
inducer/pudb#224 suggest this has been done already. cc @inducer
inducer commentedon Jan 23, 2018
inducer/pudb#224 just concerns passing on exceptions correctly. I haven't tested debug-on-test-fail with pytest and pudb, so I don't know whether it works as intended. (Although I am a heavy user of pytest, so thank you!)