-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Running doctests with -s fails? #481
Comments
Original comment by Ronny Pfannschmidt (BitBucket: RonnyPfannschmidt, GitHub: RonnyPfannschmidt): sounds like a interaction bug with the capture plugin |
Original comment by Luke Lee (BitBucket: durden, GitHub: durden): Here's a traceback of the failure when running without the -s flag. Notice how the expected text from the doctest is printed to the screen in the py.test output instead of being picked up by the test output. The test is looking for
|
Original comment by Luke Lee (BitBucket: durden, GitHub: durden): Just as another data point. I've found this doctest taken straight from scipy also doesn't work unless the -s flag is used: http://scikit-image.org/docs/dev/api/skimage.transform.html#hough-line-peaks
|
Original comment by Brianna Laugher (BitBucket: pfctdayelise, GitHub: pfctdayelise): I tried to reproduce this but so far I can't. I put the skimage example in a testfoo.txt file and it passes with or without -s. Also the code in your gist passes for me, with and without -s. The only difference I can see between our platforms is I am on Linux.
|
Original comment by Luke Lee (BitBucket: durden, GitHub: durden): I've run into this again in just simple tests using something like this simple gist. Oddly enough this test will pass in Windows and Linux. However, the same test will fail if run in OS X WITHOUT the -s flag. Guess there's something odd about the stdout capturing in OS X? |
@durden any further idea on this one, atm we don't have a OSX using volunteer that can take a look at that platform bug |
I have the exact same problem on linux... |
@NewbiZ can you please show a minimal example? |
I'm trying to, but it seems to be an environment problem. I just reused the simple gist posted above.
I'm still trying to find the root cause. Example:
From a brand new virtualenv with py.test 2.9.1:
From my conda environment, with the exact same python packages installed:
And now from the very same conda environment, addind "-s" to py.test:
Here is a stacktrace from pdb:
|
I can't reproduce this now on
Where the link is the gist posted above (source). This can be closed off? |
Hmm I can't reproduce in
I tried the same approach in an Ubuntu VM and got the same result:
@NewbiZ do still have this issue? Can you share your full set of requirements to reproduce the issue? |
My previous test case from this comment passes with and without the |
Thanks @durden! |
People can try out https://black.now.sh/?version=master to test against master. That should make issue reporting easier. See jpadilla/black-playground#6 (comment). Thanks @jpadilla!
Originally reported by: Luke Lee (BitBucket: durden, GitHub: durden)
I'm running pytest 2.5.2 with Python 2.7 and see some doctests fail unless I pass the -s flag to turn of stdout capturing. Is this expected?
This issue is either an esoteric bug in pytest or a problem with my tests.
For example, I wrote this simple test and it passes with or without the -s flag:
However, this doctest will fail if I do not use the -s flag:
The real world test is a bit more complicated, but it passes as-is with the -s flag. So, it leads me to think the issue has something to do with the stdout capturing in pytest. Also, the test passes as-is with nose and other tools regardless of log capturing.
Any ideas?
The text was updated successfully, but these errors were encountered: