Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(71449)

Side by Side Diff: Lib/test/test_import/__init__.py

Issue 23447: Import fails when doing a circular import involving an `import *`
Patch Set: Created 3 years, 6 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/test/test_import/data/circular_imports/wildcard.py ('k') | Python/ceval.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # We import importlib *ASAP* in order to test #15386 1 # We import importlib *ASAP* in order to test #15386
2 import importlib 2 import importlib
3 import importlib.util 3 import importlib.util
4 from importlib._bootstrap_external import _get_sourcefile 4 from importlib._bootstrap_external import _get_sourcefile
5 import builtins 5 import builtins
6 import marshal 6 import marshal
7 import os 7 import os
8 import platform 8 import platform
9 import py_compile 9 import py_compile
10 import random 10 import random
(...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1117 except ImportError: 1117 except ImportError:
1118 self.fail('circular import involving a subpackage failed') 1118 self.fail('circular import involving a subpackage failed')
1119 1119
1120 def test_rebinding(self): 1120 def test_rebinding(self):
1121 try: 1121 try:
1122 import test.test_import.data.circular_imports.rebinding as rebinding 1122 import test.test_import.data.circular_imports.rebinding as rebinding
1123 except ImportError: 1123 except ImportError:
1124 self.fail('circular import with rebinding of module attribute failed ') 1124 self.fail('circular import with rebinding of module attribute failed ')
1125 from test.test_import.data.circular_imports.subpkg import util 1125 from test.test_import.data.circular_imports.subpkg import util
1126 self.assertIs(util.util, rebinding.util) 1126 self.assertIs(util.util, rebinding.util)
1127
1128 def test_wildcard(self):
1129 try:
1130 import test.test_import.data.circular_imports.wildcard
1131 except (ImportError, AttributeError):
1132 self.fail('circular import with a wildcard failed')
1127 1133
1128 1134
1129 if __name__ == '__main__': 1135 if __name__ == '__main__':
1130 # Test needs to be a package, so we can do relative imports. 1136 # Test needs to be a package, so we can do relative imports.
1131 unittest.main() 1137 unittest.main()
OLDNEW
« no previous file with comments | « Lib/test/test_import/data/circular_imports/wildcard.py ('k') | Python/ceval.c » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+