Skip to content
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

Automatically stop console output capturing when pudb is used #647

Closed
pytestbot opened this issue Dec 21, 2014 · 9 comments
Closed

Automatically stop console output capturing when pudb is used #647

pytestbot opened this issue Dec 21, 2014 · 9 comments
Labels
status: help wanted developers would like help from experts on this topic type: bug problem that needs to be addressed type: enhancement new feature or API change, should be merged into features branch

Comments

@pytestbot
Copy link
Contributor

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.


@pytestbot
Copy link
Contributor Author

Original comment by holger 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)

@pytestbot pytestbot added the type: bug problem that needs to be addressed label Jun 15, 2015
@RonnyPfannschmidt RonnyPfannschmidt added type: enhancement new feature or API change, should be merged into features branch status: help wanted developers would like help from experts on this topic labels Aug 26, 2015
@RonnyPfannschmidt
Copy link
Member

Closing as stalled

@benjaminweb
Copy link

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
Copy link
Member

@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
Copy link
Contributor

twmr commented 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
Copy link

benjaminweb commented 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 -s switch: inducer/pudb#224

@nicoddemus
Copy link
Member

@Thisch indeed the --pdbcls option is not mentioned anywhere in the docs, created #3141.

@nicoddemus
Copy link
Member

What needs to be done to get the implementation with pytest right?

inducer/pudb#224 suggest this has been done already. cc @inducer

@inducer
Copy link

inducer commented 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!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: help wanted developers would like help from experts on this topic type: bug problem that needs to be addressed type: enhancement new feature or API change, should be merged into features branch
Projects
None yet
Development

No branches or pull requests

6 participants