[PATCH] Fix TestPkgRelations failures with python3.

John Wright jsw at debian.org
Sat Aug 30 15:00:08 UTC 2014


On Sun, Aug 31, 2014 at 12:14:00AM +1000, Stuart Prescott wrote:
> Hi John,
> 
> > The real implementation of assertWarns performs an iteration over
> > sys.modules.values(), which breaks because somehow the size of
> > sys.modules changes during the iteration.  I can't find where this
> > is happening (my best guess is there is some parallelism I can't find,
> > but even that is looking unlikely).  For now, overriding the real
> > implementation with our own fixes the test failure.
> 
> It's not clear to me what this change is fixing -- is the test suite failing 
> for you under some version of python? It passes for me with python3 from 
> wheezy and various versions that have been in sid and also works fine on 
> ci.debian.net so I'm not quite sure what's happening here.

At the commit before this one, I consistently get this error:

$ python3 test_deb822.py 
..................................................E.
======================================================================
ERROR: test_packages (__main__.TestPkgRelations)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_deb822.py", line 1051, in test_packages
    "foo bar")
  File "/usr/lib/python3.4/unittest/case.py", line 735, in assertWarns
    return context.handle('assertWarns', callable_obj, args, kwargs)
  File "/usr/lib/python3.4/unittest/case.py", line 161, in handle
    with self:
  File "/usr/lib/python3.4/unittest/case.py", line 205, in __enter__
    for v in sys.modules.values():
RuntimeError: dictionary changed size during iteration

----------------------------------------------------------------------
Ran 52 tests in 0.553s

FAILED (errors=1)


It happens with both python3.3 (3.3.5-1) and python3.4 (3.4.1-10).  This
is without a .pythonrc.py or any other local environment changes I can
think of.

I'm not yet sure how or why sys.modules changes size...  The workaround
works because it avoids the code path that iterates over sys.

If it works for you with the latest python3 packages from sid, I'm even
more confused.  Maybe some python3-foo library is doing something
bizarre?  We could compare package lists.

-- 
John Wright <jsw at debian.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-python-debian-maint/attachments/20140830/29d8fc9d/attachment.sig>


More information about the pkg-python-debian-maint mailing list