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

Side by Side Diff: Lib/test/test_imp.py

Issue 23670: Modifications to support iOS as a development platform
Patch Set: Created 3 years, 9 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_importlib/extension/test_loader.py ('k') | Lib/test/test_io.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 try: 1 try:
2 import _thread 2 import _thread
3 except ImportError: 3 except ImportError:
4 _thread = None 4 _thread = None
5 import importlib 5 import importlib
6 import importlib.util 6 import importlib.util
7 import os 7 import os
8 import os.path 8 import os.path
9 import shutil 9 import shutil
10 import sys 10 import sys
11 from test import support 11 from test import support
12 import unittest 12 import unittest
13 import warnings 13 import warnings
14 with warnings.catch_warnings(): 14 with warnings.catch_warnings():
15 warnings.simplefilter('ignore', DeprecationWarning) 15 warnings.simplefilter('ignore', DeprecationWarning)
16 import imp 16 import imp
17 17
18 18
19 def requires_load_dynamic(meth): 19 def requires_load_dynamic(meth):
20 """Decorator to skip a test if not running under CPython or lacking 20 """Decorator to skip a test if not running under CPython or lacking
21 imp.load_dynamic().""" 21 imp.load_dynamic()."""
22 meth = support.cpython_only(meth) 22 meth = support.cpython_only(meth)
23 return unittest.skipIf(not hasattr(imp, 'load_dynamic'), 23 return unittest.skipIf(not getattr(imp, 'load_dynamic'),
24 'imp.load_dynamic() required')(meth) 24 'imp.load_dynamic() required')(meth)
25 25
26 26
27 @unittest.skipIf(_thread is None, '_thread module is required') 27 @unittest.skipIf(_thread is None, '_thread module is required')
28 class LockTests(unittest.TestCase): 28 class LockTests(unittest.TestCase):
29 29
30 """Very basic test of import lock functions.""" 30 """Very basic test of import lock functions."""
31 31
32 def verify_lock_state(self, expected): 32 def verify_lock_state(self, expected):
33 self.assertEqual(imp.lock_held(), expected, 33 self.assertEqual(imp.lock_held(), expected,
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 name = support.TESTFN_UNENCODABLE 388 name = support.TESTFN_UNENCODABLE
389 os.mkdir(name) 389 os.mkdir(name)
390 try: 390 try:
391 self.assertRaises(ImportError, imp.NullImporter, name) 391 self.assertRaises(ImportError, imp.NullImporter, name)
392 finally: 392 finally:
393 os.rmdir(name) 393 os.rmdir(name)
394 394
395 395
396 if __name__ == "__main__": 396 if __name__ == "__main__":
397 unittest.main() 397 unittest.main()
OLDNEW
« no previous file with comments | « Lib/test/test_importlib/extension/test_loader.py ('k') | Lib/test/test_io.py » ('j') | no next file with comments »

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