Skip to content

Commit d4c76d9

Browse files
authored
bpo-30167: Add test for module.__cached__ is None (GH-7617)
1 parent cd602b8 commit d4c76d9

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

Lib/test/test_site.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,17 @@ def test_abs_paths(self):
389389
"expected absolute path, got {}"
390390
.format(os__cached__.decode('ascii')))
391391

392+
def test_abs_paths_cached_None(self):
393+
"""Test for __cached__ is None.
394+
395+
Regarding to PEP 3147, __cached__ can be None.
396+
397+
See also: https://bugs.python.org/issue30167
398+
"""
399+
sys.modules['test'].__cached__ = None
400+
site.abs_paths()
401+
self.assertIsNone(sys.modules['test'].__cached__)
402+
392403
def test_no_duplicate_paths(self):
393404
# No duplicate paths should exist in sys.path
394405
# Handled by removeduppaths()

0 commit comments

Comments
 (0)