Issue 36160: Multiple errors in test_site.py on sysconfig._CONFIG_VARS.clear() if run on its own (original) (raw)

Sample failure:

cpython\branches\3.7>python.bat -m test.test_site

Running Debug|x64 interpreter... EEEEEEEEEEEEE.s.............

ERROR: test_addpackage (main.HelperFunctionsTests)

Traceback (most recent call last): File "C:\Users\Sasha\Documents\cpython\branches\3.7\lib\test\test_site.py", li ne 77, in tearDown sysconfig._CONFIG_VARS.clear() AttributeError: 'NoneType' object has no attribute 'clear'

====================================================================== ERROR: test_addpackage_import_bad_exec (main.HelperFunctionsTests)

Traceback (most recent call last): File "C:\Users\Sasha\Documents\cpython\branches\3.7\lib\test\test_site.py", li ne 77, in tearDown sysconfig._CONFIG_VARS.clear() AttributeError: 'NoneType' object has no attribute 'clear'

The reason is that sysconfig._CONFIG_VARS' is None until the first call to sysconfig.get_config_vars()'. When the suite is used in conjunction with the others, other tests have already called it by the time test_site.py gets control.