Issue 17731: test_iter_importers intermittent failure in test_pkgutil (original) (raw)

A buildbot produced the following traceback, but the test passed when re-run.

http://buildbot.python.org/all/builders/x86%20Gentoo%203.3/builds/630/steps/test/logs/stdio

test_loader_deprecated (test.test_pkgutil.ImportlibMigrationTests) ... ok

====================================================================== ERROR: test_iter_importers (test.test_pkgutil.ExtendPathTests)

Traceback (most recent call last): File "", line 1521, in _find_and_load_unlocked AttributeError: 'module' object has no attribute 'path'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/var/lib/buildslave/3.3.murray-gentoo/build/Lib/test/test_pkgutil.py", line 206, in test_iter_importers importlib.import_module(fullname) File "/var/lib/buildslave/3.3.murray-gentoo/build/Lib/importlib/init.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1586, in _gcd_import File "", line 1567, in _find_and_load File "", line 1524, in _find_and_load_unlocked ImportError: No module named 'spam.eggs'; spam is not a package

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/var/lib/buildslave/3.3.murray-gentoo/build/Lib/test/test_pkgutil.py", line 226, in test_iter_importers del sys.modules['spam.eggs'] KeyError: 'spam.eggs'

"spam" is a fairly generic name, so I'm guessing something else is leaving a "spam" module around in sys.modules - when I run the tests with the order given in RDM's original report, I get the same error.

I also get a failure in test_builtin though, which is a little weird.

With the attached file, test_builtin fails (so one of the uncommented tests appears to be interfering with that), while test_pkgutil passes (suggesting that the problem there is one the tests flagged with "#TEMP#"