Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-30167: Add test for module.__cached__ is None #7617

Merged
merged 1 commit into from
Oct 1, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Lib/test/test_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,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()
Expand Down