unittest buffing output on windows?

Dave Angel davea at ieee.org
Mon Dec 7 15:20:16 EST 2009


Roy Smith wrote:
> I'm running 2.5.1.  I've got a test suite that takes about 15 minutes
> to complete.  On my unix boxes, as each test case executes, it prints
> out a line (I'm using unittest.TextTestRunner(verbosity=2)) of status,
> but on my windows box (running under cygwin), it buffers everything
> until the entire test suite is completed.
>
> I can stick sys.stdout.flush() and sys.stderr.flush() in my tearDown()
> method, which gets me output, but that doesn't seem like the right
> solution.  Is there a better way to get the test runner to flush
> output  after every test case?
>
>   
You could try starting Python with the -u switch, which says don't 
buffer stdout. or stderr (at least on Python 2.6).  Try running
    python -?

to see the commandline options.  On the other hand, if it's specifically 
a cygwin problem, I have no idea.

DaveA




More information about the Python-list mailing list