[py-dev] Issue with py.test and stderr

walter at livinglogic.de walter at livinglogic.de
Sat Jan 15 01:34:00 CET 2005


> Hi, Holger
>
> I started to play with py.test after seeing it mentioned on a lot of
> Python-related blogs. I find it really easy to use and powerful at the
> same time, so congrats for a fine piece of work.
>
> I did run into a slight issue though. At some point I was instantiating
> a class which was redirecting stderr to stdout under some
> circumstances. The __del__ method of my class was resetting sys.stderr
> to sys.__stderr__.

Don't do that. Never use sys.__stderr__. Instead store the old value
in a temporary variable and restore sys.stderr afterwards.

See:
http://groups.google.com/groups?lr=&selm=just-E1C26C.10084603012005%40news1.news.xs4all.nl
Bye,
   Walter Dörwald






More information about the Pytest-dev mailing list