[issue40275] test.support has way too many imports
STINNER Victor
report at bugs.python.org
Mon Aug 10 17:32:12 EDT 2020
STINNER Victor <vstinner at python.org> added the comment:
Update.
"import test.support" now imports 37 modules, instead of 171 previously. It's way better!
23:26:20 vstinner at apu$ ./python
Python 3.10.0a0 (heads/master:598a951844, Aug 7 2020, 17:24:10)
[GCC 10.2.1 20200723 (Red Hat 10.2.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> import test
>>> before=set(sys.modules)
>>> import test.support
>>> after=set(sys.modules)
>>> len(after - before)
37
>>> import pprint; pprint.pprint(sorted(after - before))
['_datetime',
'_elementtree',
'_heapq',
'_sysconfigdata_d_linux_x86_64-linux-gnu',
'_testcapi',
'_weakrefset',
'argparse',
'copy',
'datetime',
'difflib',
'fnmatch',
'gettext',
'heapq',
'math',
'pprint',
'pyexpat',
'pyexpat.errors',
'pyexpat.model',
'signal',
'sysconfig',
'test.support',
'test.support.testresult',
'traceback',
'unittest',
'unittest.case',
'unittest.loader',
'unittest.main',
'unittest.result',
'unittest.runner',
'unittest.signals',
'unittest.suite',
'unittest.util',
'weakref',
'xml',
'xml.etree',
'xml.etree.ElementPath',
'xml.etree.ElementTree']
Shorter list if imports made by unittest are ignored:
23:27:42 vstinner at apu$ ./python
Python 3.10.0a0 (heads/master:598a951844, Aug 7 2020, 17:24:10)
[GCC 10.2.1 20200723 (Red Hat 10.2.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys, unittest, test
>>> before=set(sys.modules)
>>> before=set(sys.modules); import test.support; after=set(sys.modules)
>>> len(after) - len(before)
17
>>> import pprint; pprint.pprint(sorted(after - before))
['_datetime',
'_elementtree',
'_sysconfigdata_d_linux_x86_64-linux-gnu',
'_testcapi',
'copy',
'datetime',
'math',
'pyexpat',
'pyexpat.errors',
'pyexpat.model',
'sysconfig',
'test.support',
'test.support.testresult',
'xml',
'xml.etree',
'xml.etree.ElementPath',
'xml.etree.ElementTree']
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40275>
_______________________________________
More information about the Python-bugs-list
mailing list