This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Multiple errors in test_site.py on sysconfig._CONFIG_VARS.clear() if run on its own
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Ivan.Pozdeev, iritkatriel, miss-islington
Priority: normal Keywords: patch

Created on 2019-03-01 18:39 by Ivan.Pozdeev, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 12131 merged Ivan.Pozdeev, 2019-03-01 18:48
PR 26262 merged miss-islington, 2021-05-20 10:25
PR 26263 merged miss-islington, 2021-05-20 10:25
Messages (3)
msg336947 - (view) Author: Ivan Pozdeev (Ivan.Pozdeev) * Date: 2019-03-01 18:39
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'

<etc>

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.
msg394010 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2021-05-20 10:41
New changeset b9258b03b864520525176f927156b85a532a9d7c by Miss Islington (bot) in branch '3.9':
bpo-36160: Fix test_site so that it can run independently of other tests (GH-12131) (GH-26263)
https://github.com/python/cpython/commit/b9258b03b864520525176f927156b85a532a9d7c
msg394011 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2021-05-20 10:42
New changeset 4389711ce935bef3844dd24d7fe8460a5fef62e6 by Miss Islington (bot) in branch '3.10':
bpo-36160: Fix test_site so that it can run independently of other tests (GH-12131) (GH-26262)
https://github.com/python/cpython/commit/4389711ce935bef3844dd24d7fe8460a5fef62e6
History
Date User Action Args
2022-04-11 14:59:11adminsetgithub: 80341
2021-05-20 10:42:18iritkatrielsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2021-05-20 10:42:04iritkatrielsetmessages: + msg394011
2021-05-20 10:42:00iritkatrielsetnosy: + iritkatriel
messages: + msg394010
2021-05-20 10:25:51miss-islingtonsetpull_requests: + pull_request24867
2021-05-20 10:25:46miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request24866
2021-05-20 10:24:03iritkatrielsetversions: + Python 3.9, Python 3.10, Python 3.11, - Python 3.7, Python 3.8
2019-03-01 18:48:34Ivan.Pozdeevsetkeywords: + patch
stage: patch review
pull_requests: + pull_request12134
2019-03-01 18:39:20Ivan.Pozdeevcreate