[PATCH] Fix TestPkgRelations failures with python3.
Stuart Prescott
stuart at debian.org
Sun Aug 31 01:18:42 UTC 2014
Hi John,
An impressive puzzle!
> 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)
A quick search tells me this has come up a few times before with various other
modules normally taking the blame for the behaviour, for instance:
https://bitbucket.org/gutworth/six/issue/68/assertwarns-and-six
It looks like pydoc had this problem too and this was solved by disabling the
affected tests:
http://bugs.python.org/issue20484
Perhaps case.py should be wrapping sys.modules.values() in a list() but I also
can't see how walking over sys.modules.values() like this could cause the dict
to be changed. That said, six does a lot of lazy loading of modules, but I
don't know why this is different for you compared to me and ci.debian.net.
> 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.
$ git checkout db4d5584e5833866c4c216d1a8772518e0d1451f
On my local machine (wheezy with lots and lots of stuff installed)
$ dpkg -l python3.2
ii python3.2 3.2.3-7 amd64 Interactive high-level object
$ python3 test_deb822.py
....................................................
----------------------------------------------------------------------
Ran 52 tests in 0.665s
OK
In a not-particularly-clean sid schroot:
$ dpkg -l python3,4
ii python3.4 3.4.1-10 amd64 Interactive high-level object-ori
$ python3 test_deb822.py
....................................................
----------------------------------------------------------------------
Ran 52 tests in 0.810s
In a very clean build schroot either manually or letting adt-run it:
# dpkg -l python3.4
ii python3.4 3.4.1-10 amd64 Interactive high-level object-ori
# python3 test_deb822.py
....................................................
----------------------------------------------------------------------
Ran 52 tests in 0.682s
> 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.
It seems very weird that this test should be iterating over sys in the first
place.
> 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.
Indeed ...it works for me with oldish sid packages and current sid packages.
Well a reasonable starting point for that would be to try it out in a clean
chroot:
# http_proxy=http://localhost:3142/ debootstrap sid sid-amd64
http://http.debian.net/debian
# cp -a .../python-debian/ sid-amd64/tmp
# chroot sid-amd64
# apt-get install python3 python3-apt python3-chardet python3-six
# cd /tmp/python-debian/tests
# python3 test_deb822.py
....................................................
----------------------------------------------------------------------
Ran 52 tests in 0.103s
There's very little python3 installed in that chroot at all at that stage:
# dpkg -l |grep python3 | awk '{print $2}'
libpython3-stdlib:amd64
libpython3.4-minimal:amd64
libpython3.4-stdlib:amd64
python3
python3-apt
python3-chardet
python3-minimal
python3-pkg-resources
python3-six
python3.4
python3.4-minimal
cheers
Stuart
--
Stuart Prescott http://www.nanonanonano.net/ stuart at nanonanonano.net
Debian Developer http://www.debian.org/ stuart at debian.org
GPG fingerprint 90E2 D2C1 AD14 6A1B 7EBB 891D BBC1 7EBB 1396 F2F7
More information about the pkg-python-debian-maint
mailing list