Skip to content

Commit b9258b0

Browse files
bpo-36160: Fix test_site so that it can run independently of other tests (GH-12131) (GH-26263)
(cherry picked from commit 1270ad6) Co-authored-by: native-api <[email protected]>
1 parent eecdc9e commit b9258b0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Lib/test/test_site.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,10 @@ def tearDown(self):
7676
site.USER_SITE = self.old_site
7777
site.PREFIXES = self.old_prefixes
7878
sysconfig._CONFIG_VARS = self.original_vars
79-
sysconfig._CONFIG_VARS.clear()
80-
sysconfig._CONFIG_VARS.update(self.old_vars)
79+
# _CONFIG_VARS is None before get_config_vars() is called
80+
if sysconfig._CONFIG_VARS is not None:
81+
sysconfig._CONFIG_VARS.clear()
82+
sysconfig._CONFIG_VARS.update(self.old_vars)
8183

8284
def test_makepath(self):
8385
# Test makepath() have an absolute path for its first return value

0 commit comments

Comments
 (0)