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

pytest.call_nocapture(func, *k, **kw) #167

Closed
pytestbot opened this issue Jul 3, 2012 · 8 comments
Closed

pytest.call_nocapture(func, *k, **kw) #167

pytestbot opened this issue Jul 3, 2012 · 8 comments
Labels
good first issue easy issue that is friendly to new contributor type: enhancement new feature or API change, should be merged into features branch

Comments

@pytestbot
Copy link
Contributor

Originally reported by: Ronny Pfannschmidt (BitBucket: RonnyPfannschmidt, GitHub: RonnyPfannschmidt)


would be usefull as a way for pthers to integrate other debuggers/tools


@pytestbot
Copy link
Contributor Author

Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42):


and what's the behaviour exactly?

@pytestbot
Copy link
Contributor Author

Original comment by Ronny Pfannschmidt (BitBucket: RonnyPfannschmidt, GitHub: RonnyPfannschmidt):


  • restore normal stdout/err
  • print the current output
  • call function
  • restore capture

could have a better name

@pytestbot pytestbot added the type: enhancement new feature or API change, should be merged into features branch label Jun 15, 2015
@RonnyPfannschmidt RonnyPfannschmidt added the good first issue easy issue that is friendly to new contributor label Jul 25, 2015
@nicoddemus
Copy link
Member

Hmmm in order to suspend capture, one would have to have access to the CaptureManager plugin in order to be able to call suspendcapture_item and resumecapture during the pytest.no_capture call (I think pytest.disable_capture would be better btw).

How about adding context manager support to capsys and capfd like this:

def test_foo(capsys):
    print('captured')
    with capsys.disabled():
         print('directly to stdout, regardless of the "-s" flag')
    print('captured again')

?

cc @RonnyPfannschmidt @hpk42

@RonnyPfannschmidt
Copy link
Member

nice idea 👍

@hpk42
Copy link
Contributor

hpk42 commented Sep 22, 2015

why would the disabled() call send things to the users stdout instead of it going to normal pytest capturing? i am kind of missing the problem statement and why it would help with debuggers.

@RonnyPfannschmidt
Copy link
Member

basically all debuggers currently break due to missing integration (with the notable exception of pdbpp)

@demianbrecht
Copy link
Contributor

Another related issue is if you're mucking about with terminal settings as detailed in #1182 (closed as it should be resolved by the solution being discussed here). Because the object responsible for capturing doesn't implement the full file API (specifically fileno is where I got to), it fails when capturing is on.

Having the ability to disable capturing for a specific test would also solve this problem.

@RonnyPfannschmidt
Copy link
Member

Closing this one since its badly scoped, capture related items will happen later

fkohlgrueber pushed a commit to fkohlgrueber/pytest that referenced this issue Oct 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue easy issue that is friendly to new contributor type: enhancement new feature or API change, should be merged into features branch
Projects
None yet
Development

No branches or pull requests

5 participants