-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
capsys.disabled for stdin #2189
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
Input directly kills test automation, why do you want that in automated tests? |
FWIW I had this kind of scenario before (before I switched to pytest): I wrote tests in Python for an embedded display drawing firmware (written in C). Many tests were automated (communicating with the display over serial port, checking things it gets back, etc.). However, there is no way I could check if the actual drawing is correct automatically - so I had a test drawing a picture and asked the tester (i.e. myself) if it looks like a reference picture. That test was disabled by default and enabled with a commandline argument, but from time to time it was very valuable. |
@The-Compiler but those manual tests dont need to be part of a automated testsuite, this could be just a script |
Sure, the automated tests also could simply be a script. Using a test runner instead provides a lot of convenience, just like with automated tests. |
Regardless of the use case, seems reasonable to me for Looking at the code it seems that this is what the |
I'm basically doing the same thing as @The-Compiler actually. I'm glad to hear that I'm not crazy WRT |
I was hoping this would work so I could make a fixture for dropping into ipdb within tests. However, I still get this output when I do https://gist.github.com/dusktreader/ee17bcc1cf282093556cabc636e4ef00 Still looking for a viable workaround for debugging with ipdb |
You're not crazy, I had a related problem in the past (also hardware testing) - there is a way to temporarily suspend capturing: #4210 (comment) |
@bilderbuchi Thanks so much for pointing that stuff out! I was able to build my
|
@dusktreader |
@blueyed Because I prefer ipython as a repl |
@dusktreader |
Surfacing this very frequently esp. when we tend to use execute() API of fabfile.py in pytest to run some test case. Any workarounds. I tried with capsys.disabled(), but surface the same. I am using fabric 1.14.1 and pytest 3.7.2
logs of this show -
|
This would be very useful to have for using pytest as a runner for interactive tests. Yes, it could be done with scripts, but pytest brings a whole host of features that are helpful. This should be fairly simple, can't we just propagate the with capsys.disabled(in_=True):
input('...') |
Uh oh!
There was an error while loading. Please reload this page.
I'm using pytest 3.0.4
Currently, using capsys.disabled prevents the capturing on stdout. But it does not do anything for stdin, which is also important for my use. (specifically, I want to be able to use input().)
Adding the -s command line option works, but I'd like to do it programmatically in a test. Ideally, you'd get something like this:
I'm not sure whether only disabling the capturing of stdout is expected behavior (in which case I would like a way to do what I'm doing above) or a bug.
The text was updated successfully, but these errors were encountered: