Testing & stdout
Peter Hansen
peter at engcorp.com
Tue Nov 4 10:44:54 EST 2003
Peter Hansen wrote:
>
> Miki Tebeka wrote:
> >
> > In my test suite I also test some function that output messages to stdout.
> > Is there an easy way to temporary divert stdout to another location?
> >
> > Currently I'm using:
> [snip]
> > This works fine if no one is caching stdout somewhere.
>
> "Caching stdout"? What's that mean? Who would do such a thing?
Ah, reading John's reply I think I figured out what you meant.
You mean some of the code being called is using a saved reference
to sys.stdout, and so it won't dynamically pick your changed version
of that name.
I encountered the same problem once, and found no solution.
-Peter
More information about the Python-list
mailing list