]> granicus.if.org Git - python/commitdiff
bpo-30167: Add test for module.__cached__ is None (GH-7617)
authorINADA Naoki <methane@users.noreply.github.com>
Mon, 1 Oct 2018 12:10:37 +0000 (21:10 +0900)
committerGitHub <noreply@github.com>
Mon, 1 Oct 2018 12:10:37 +0000 (21:10 +0900)
Lib/test/test_site.py

index dc59e5917cfaf08d20bdef07ff0e3f242fc36dce..33a8f1a44ccc932fb078f36c7f0973a5e0f30ae6 100644 (file)
@@ -389,6 +389,17 @@ class ImportSideEffectTests(unittest.TestCase):
                             "expected absolute path, got {}"
                             .format(os__cached__.decode('ascii')))
 
+    def test_abs_paths_cached_None(self):
+        """Test for __cached__ is None.
+
+        Regarding to PEP 3147, __cached__ can be None.
+
+        See also: https://bugs.python.org/issue30167
+        """
+        sys.modules['test'].__cached__ = None
+        site.abs_paths()
+        self.assertIsNone(sys.modules['test'].__cached__)
+
     def test_no_duplicate_paths(self):
         # No duplicate paths should exist in sys.path
         # Handled by removeduppaths()