How do I see stdout when running Django tests?


When I run tests with ./ test, whatever I send to the standard output through print doesn't show. When tests fail, I see an "stdout" block per failed test, so I guess Django traps it (but doesn't show it when tests pass).

8/6/2009 3:07:07 PM

Accepted Answer

Checked TEST_RUNNER in, it's using a project-specific runner that calls out to Nose. Nose has the -s option to stop it from capturing stdout, but if I run:

./ test -s captures it first and throws a "no such option" error. The help for doesn't mention this, but I found that if I run:

./ test -- -s

it ignores the -s and lets me capture it on the custom runner's side, passing it to Nose without a problem.

8/6/2009 3:09:16 PM

Yeah, this issue is caused by NoseTestSuiteRunner. Adding -- -s is tricky and not the best solution. Try to add the following lines in the

NOSE_ARGS = ['--nocapture',

This solved my problems.

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow