Skip to content

Automatically stop console output capturing when pudb is used #647

Closed

Description

@pytestbot

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.


Activity

  1. pytestbot commented on Dec 21, 2014

    @pytestbot
    ContributorAuthor

    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)

  2. added
    type: bug
    on Jun 15, 2015
  3. added
    type: enhancement
    status: help wanted
    on Aug 26, 2015
  4. RonnyPfannschmidt commented on Jan 1, 2016

    @RonnyPfannschmidt
    Member

    Closing as stalled

  5. benjaminweb commented on Jan 22, 2018

    @benjaminweb

    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.

  6. RonnyPfannschmidt commented on Jan 22, 2018

    @RonnyPfannschmidt
    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

  7. twmr commented on Jan 22, 2018

    @twmr
    Contributor

    @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.

  8. benjaminweb commented on Jan 22, 2018

    @benjaminweb

    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

  9. nicoddemus commented on Jan 22, 2018

    @nicoddemus
    Member

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

  10. nicoddemus commented on Jan 22, 2018

    @nicoddemus
    Member

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

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

  11. inducer commented on Jan 23, 2018

    @inducer

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: help wantedtype: bugtype: enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions