[Python-checkins] bpo-30167: Add test for module.__cached__ is None (GH-7617)

INADA Naoki webhook-mailer at python.org
Mon Oct 1 08:10:44 EDT 2018


https://github.com/python/cpython/commit/d4c76d960b8b286b75c933780416ace9cda682fd
commit: d4c76d960b8b286b75c933780416ace9cda682fd
branch: master
author: INADA Naoki <methane at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2018-10-01T21:10:37+09:00
summary:

bpo-30167: Add test for module.__cached__ is None (GH-7617)

files:
M Lib/test/test_site.py

diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py
index dc59e5917cfa..33a8f1a44ccc 100644
--- a/Lib/test/test_site.py
+++ b/Lib/test/test_site.py
@@ -389,6 +389,17 @@ def test_abs_paths(self):
                             "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()



More information about the Python-checkins mailing list