Testing, allow test output to redirected to a different output stream or multiple output streams
|Reported by:||man_nick_utd||Owned by:||nobody|
|Severity:||Keywords:||Redirect test output|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
When using the command
python manage.py test
In my circumstance i would like to redirect the test output to a file, but in other instances redirecting to the stout and a file would be useful.
For unittest.TextTestRunner you can specify the stream to use in the constructor, if this option could be added to a command line option for the above command.
The reason i don't just use
python manage.py test > testoutput.txt
is because if the database has already been created and you want to recreate the database the option to recreate the database will not be displayed on the screen it will be piped to the file.
At the moment i have written my own testrunner to implement this option but having used JUnit and CPPUnit before and knowing this is a feature available to both of them (CPPUnit easier then JUnit) i thought this would be a cool option to add to Django.
A possible solution would be to add an option to the settings file
python manage.py test --settings=settings
and in the settings file
TEST_RUNNER_OUTPUT_STREAM=testoutput.txt or something.