While I know that this can be done from the command line nosetests --nocapture test.py
I would like to know if is it possible to add code into test.py
so that I can just type nosetests test.py
without adding --nosecapture
.
You can see the print statements by adding the -s
flag to your terminal command. e.g.
$ nosetests -s test.py
-s, --nocapture
Don’t capture stdout (any stdout output will be printed immediately) [NOSE_NOCAPTURE].
Check the official document here
You can do it by either defining environment NOSE_NOCAPTURE
variable, creating .noserc
or nose.cfg
file in your home directory that will have something like:
[nosetests]
nocapture=1
or by passing arguments to nose directly in python when calling nose.run()
as described in nose documentation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With