help: Unit test fixture returning the same object

Peter Otten __peter__ at web.de
Wed Aug 4 13:12:18 EDT 2004


Michael McCracken wrote:

> I did try the global count idea, and I did get an increasing count,
> despite the same id oddity. So new instances seem to be getting
> created, with the same data structures. I don't think I'm accidentally
> using class variables, and that is the only thing I can think of. Any
> more tips?

1 Make a minimal script showing the offensive behaviour
2 Post it on c.l.py

Incidentally, step 2 is often unnecessary, because the error (if any) is
found in 1 :-)

More concrete, you could inhibit garbage collection of File instances by
keeping old files around, e. g. in a global list. If ids are still the same
you are definitely seeing the effect of a coding error.

Peter



More information about the Python-list mailing list