problems redirecting unittest output to sys.stdout

Philip Swartzleonard starx at pacbell.net
Sat Apr 27 05:19:27 EDT 2002


Achim Domma || Sat 27 Apr 2002 02:13:33a:

> Hi,
> 
> I want to redirect the output of a unittest to a textfile (on
> Windows). The default stream is sys.stderr which can not be redirected
> on windows. Until now I started my tests like this :
> 
> [..code..]
> 
> This way the output is redirected to sys.stdout, but the command line
> parameters are ignored. If I call my script with the '-v' parameter, I
> get no verbose output. I have no idee where the parameters get lost !?
> 
> any idea ?

This is one of the reasons i keep cygwin around. Link your windows 
python binary something like /bin/wpy, and run 'wpy foo.py 2>&1 > 
out.txt' or however you redirect streams under unix (haven't done it in 
a while =).

There are also some free little 'bootstrap' kinda programs for windows, 
which do something along the lines of '1. copy stderr to stdout, 2. run 
whatever you pass to it as an argument' (like some slowdown programs). 
This would be a significantly smaller way of getting what you want =)

-- 
Philip Sw "Starweaver" [rasx] :: www.rubydragon.com



More information about the Python-list mailing list