summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-05-20 03:41:43 -0700
committerGitHub <noreply@github.com>2021-05-20 11:41:43 +0100
commitb9258b03b864520525176f927156b85a532a9d7c (patch)
tree6bbcfe5a31ffbef7b537abcbb37bb2c2e9af53ec
parenteecdc9e1f73a1d96f8ca604dba4f529c86d16fbd (diff)
downloadcpython-git-b9258b03b864520525176f927156b85a532a9d7c.tar.gz
bpo-36160: Fix test_site so that it can run independently of other tests (GH-12131) (GH-26263)
(cherry picked from commit 1270ad6ec8fe1f71e7d88086474f96f99670ac3a) Co-authored-by: native-api <vano@mail.mipt.ru>
-rw-r--r--Lib/test/test_site.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py
index 5a3bd1828e..3d25d7e473 100644
--- a/Lib/test/test_site.py
+++ b/Lib/test/test_site.py
@@ -76,8 +76,10 @@ class HelperFunctionsTests(unittest.TestCase):
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