Author drudd
Recipients drudd
Date 2015-01-20.04:48:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1421729308.95.0.570059573722.issue23279@psf.upfronthosting.co.za>
In-reply-to
Content
pth files for logilab (e.g. logilab_common, logilab_astng) and mpl_toolkit (e.g. basemap, matplotlib) contain code like the following (taken from basemap 1.0.7):

import sys, types, os;p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('mpl_toolkits',));ie = os.path.exists(os.path.join(p,'__init__.py'));m = not ie and sys.modules.setdefault('mpl_toolkits', types.ModuleType('mpl_toolkits'));mp = (m or []) and m.__dict__.setdefault('__path__',[]);(p not in mp) and mp.append(p)

This leads to the types module being loaded on import, which then causes test_site/test_startup_imports to fail since types is in collection_mods:

        collection_mods = {'_collections', 'collections', 'functools',
                           'heapq', 'itertools', 'keyword', 'operator',
                           'reprlib', 'types', 'weakref'
                          }.difference(sys.builtin_module_names)
        self.assertFalse(modules.intersection(collection_mods), stderr)

$ python3.4 -c 'import sys; print(set(sys.modules))'
{'builtins', '_codecs', 'io', 'errno', 'abc', '_weakref', '_collections_abc', '_bootlocale', 'stat', 'os', '_frozen_importlib', 'encodings.utf_8', '_sitebuiltins', '_sysconfigdata', 'sysconfig', 'posixpath', 'sys', 'mpl_toolkits', '_weakrefset', 'encodings', 'encodings.aliases', 'signal', '__main__', '_stat', 'zipimport', 'genericpath', 'site', '_io', 'posix', 'codecs', 'types', '_imp', 'os.path', '_warnings', 'marshal', '_locale', '_thread', 'encodings.latin_1'}


This is a similar bug to http://bugs.python.org/issue20986 

I don't know the purpose of this test well enough to propose a fix, but given the number of exceptions already there it doesn't seem to be a robust test.
History
Date User Action Args
2015-01-20 04:48:29druddsetrecipients: + drudd
2015-01-20 04:48:28druddsetmessageid: <1421729308.95.0.570059573722.issue23279@psf.upfronthosting.co.za>
2015-01-20 04:48:28druddlinkissue23279 messages
2015-01-20 04:48:28druddcreate