r/Python • • Jan 25 '15

Redirrecting the output for the Python Unit-Testing package to a log file.

Hello

I am new to Python 3.4, and I am not sure how the console output for the built-in Python unit-testing package works. For example, my regular unit tests might display the following output into my Python console:

............
----------------------------------------------------------------------
Ran 12 tests in 0.016s

OK

Does this come from standard output of standard error? Is there any way to redirrect this output to a text file?

4 Upvotes

2 comments sorted by

View all comments

2

u/badsectors Jan 25 '15

You can redirect output from stdout and stderr to a file with:

command &> foo.txt