summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorINADA Naoki <methane@users.noreply.github.com>2018-10-01 12:10:37 (GMT)
committerGitHub <noreply@github.com>2018-10-01 12:10:37 (GMT)
commitd4c76d960b8b286b75c933780416ace9cda682fd (patch)
treec7fdaf5fedd44c45ed5882a6b15f20b5dd03510a
parentcd602b8af2d14ff686261eeb18b80f718bb16550 (diff)
downloadcpython-d4c76d960b8b286b75c933780416ace9cda682fd.zip
cpython-d4c76d960b8b286b75c933780416ace9cda682fd.tar.gz
cpython-d4c76d960b8b286b75c933780416ace9cda682fd.tar.bz2
bpo-30167: Add test for module.__cached__ is None (GH-7617)
-rw-r--r--Lib/test/test_site.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py
index dc59e59..33a8f1a 100644
--- a/Lib/test/test_site.py
+++ b/Lib/test/test_site.py
@@ -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()