[Zope3-checkins] CVS: Zope3/src/zope/proxy/context/tests -
test_wrapper.py:1.4
Jeremy Hylton
jeremy@zope.com
09 Apr 2003 11:05:34 -0400
On Wed, 2003-04-09 at 08:54, Steve Alexander wrote:
> Update of /cvs-repository/Zope3/src/zope/proxy/context/tests
> In directory cvs.zope.org:/tmp/cvs-serv29115/src/zope/proxy/context/tests
>
> Modified Files:
> test_wrapper.py
> Log Message:
> Rather than make new types each test run, we make the types once
> and cache them in case the same unit test is run multiple times.
>
>
> === Zope3/src/zope/proxy/context/tests/test_wrapper.py 1.3 => 1.4 ===
> --- Zope3/src/zope/proxy/context/tests/test_wrapper.py:1.3 Tue Apr 8 08:21:39 2003
> +++ Zope3/src/zope/proxy/context/tests/test_wrapper.py Wed Apr 9 08:54:38 2003
> @@ -21,6 +21,11 @@
>
> _marker = object()
>
> +# We need to make a load of new types. If tests are run multiple times,
> +# only make each required new type once, and cache it here.
> +# Otherwise, it looks like we have a refcount leak.
> +class_lookup = {}
> +
This may be masking a problem. The type objects should not leak if they
are created dynamically (as opposed to statically in a C extension).
BTW, can't this
t1 = type('ContextUnawareObj', (), {slot: doit})
be spelled as
class ContextUnawareObj(object):
slot = doit
Jeremy