Testing & stdout

John Roth newsgroups at jhrothjr.com
Wed Nov 5 03:03:56 EST 2003


"Miki Tebeka" <mikit at zoran.co.il> wrote in message
news:6250403b.0311042334.7cf5a8ce at posting.google.com...
> 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?

Shared code ownership. The classical model says the tester writes
up a report and gets frustrated. The XP model says that if you find
it hard to test, you find a developer, sit down with him and fix it
so you can test it.

John Roth
>
> Miki






More information about the Python-list mailing list