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

swallowing stdout #21

Open
ssfrr opened this issue Jun 28, 2014 · 8 comments
Open

swallowing stdout #21

ssfrr opened this issue Jun 28, 2014 · 8 comments

Comments

@ssfrr
Copy link

ssfrr commented Jun 28, 2014

When testing code that prints to stdout, the output gets interleaved with the test status output.

In at least one of the python test runners the runner swallows stdout and only displays it on a test failure. If the tests are passing you can assume the user doesn't really care what got printed.

Not sure how exactly to implement this, but I wanted to feel out whether it would be considered a desired feature.

@zachallaun
Copy link
Contributor

I'm not a fan of this as a default (I believe it leads to confusing behavior if you're not expecting it), but I'd welcome it as some kind of configuration option. If you want to take a crack at it and #19, feel free to include the changes together.

@IainNZ
Copy link
Contributor

IainNZ commented Oct 31, 2014

This could possibly be an option, but I need to think about it. Certainly wouldn't be default option. When a failure occurs, does it print all STDOUT from the context, or just the statement?

@ssfrr
Copy link
Author

ssfrr commented Nov 2, 2014

The way it works in some other test frameworks I've used (I think nose.py does this) is that for each test case any generated STDOUT is suppressed, but if a given test fails than all the STDOUT from that test is printed, so you have more context. It makes test results a lot more concise, especially for passing tests where you generally don't care to see extra prints.

@IainNZ
Copy link
Contributor

IainNZ commented Nov 4, 2014

This is my next todo, and will involve redirect_stdout()

@IainNZ
Copy link
Contributor

IainNZ commented Nov 4, 2014

e.g.

oldstdout = STDOUT
rd, wr = redirect_stdout()
println("you won't see me")
readavailable(rd)
redirect_stdout(oldstdout)
println("you will see me")

@oxinabox
Copy link

Any update on this?

@IainNZ
Copy link
Contributor

IainNZ commented May 10, 2016

I'm not working on this (or this package), in favor of Base.Test (and its packaged version BaseTestNext)

@oxinabox
Copy link

fair enough, thanks.
on that basis I will move all future tests I write over to Base.Test/BaseTestNext.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants