[Python-checkins] bpo-36160: Fix test_site so that it can run independently of other tests (GH-12131) (GH-26262)
iritkatriel
webhook-mailer at python.org
Thu May 20 06:42:04 EDT 2021
https://github.com/python/cpython/commit/4389711ce935bef3844dd24d7fe8460a5fef62e6
commit: 4389711ce935bef3844dd24d7fe8460a5fef62e6
branch: 3.10
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: iritkatriel <iritkatriel at yahoo.com>
date: 2021-05-20T11:42:00+01:00
summary:
bpo-36160: Fix test_site so that it can run independently of other tests (GH-12131) (GH-26262)
(cherry picked from commit 1270ad6ec8fe1f71e7d88086474f96f99670ac3a)
Co-authored-by: native-api <vano at mail.mipt.ru>
files:
M Lib/test/test_site.py
diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py
index 9b4ab42a727b4..fa74e7770ede2 100644
--- a/Lib/test/test_site.py
+++ b/Lib/test/test_site.py
@@ -79,8 +79,10 @@ def tearDown(self):
site.USER_SITE = self.old_site
site.PREFIXES = self.old_prefixes
sysconfig._CONFIG_VARS = self.original_vars
- sysconfig._CONFIG_VARS.clear()
- sysconfig._CONFIG_VARS.update(self.old_vars)
+ # _CONFIG_VARS is None before get_config_vars() is called
+ if sysconfig._CONFIG_VARS is not None:
+ sysconfig._CONFIG_VARS.clear()
+ sysconfig._CONFIG_VARS.update(self.old_vars)
def test_makepath(self):
# Test makepath() have an absolute path for its first return value
More information about the Python-checkins
mailing list