Testing & stdout

Miki Tebeka mikit at zoran.co.il
Wed Nov 5 02:34:38 EST 2003


Hello John,

> > 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.
Yes. Sorry I wasn't clear the 1'st time.

> > I encountered the same problem once, and found no solution.
:-(

> Good point. If he's using unittest, it's a problem in only one case:
> where the cached reference is at the module level. Otherwise,
> each unit test starts fresh.
To eliminate this problem you can always find the problematic module
and do a "reload" at the TestCase "setUp" function. However this
requiers you to track down all offending modules, which is error
prone.

> If it's at the module level, then the unit test suite has to do something
> different. I'd fix the offending module, but possibly he isn't using
> XP, so he can't do that.
XP as in eXtreme Programming? What's the connection?

Miki




More information about the Python-list mailing list