]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-36160: Fix test_site so that it can run independently of other tests (GH-12131)
authornative-api <vano@mail.mipt.ru>
Thu, 20 May 2021 10:25:37 +0000 (13:25 +0300)
committerGitHub <noreply@github.com>
Thu, 20 May 2021 10:25:37 +0000 (11:25 +0100)
Lib/test/test_site.py

index 9b4ab42a727b4fce606c17f909b22247bb6e6010..fa74e7770ede292f0209516252a56cb28f997804 100644 (file)
@@ -79,8 +79,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