MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_import

Method test_import

Lib/test/_test_multiprocessing.py:4891–4915  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

4889 return modules
4890
4891 def test_import(self):
4892 modules = self.get_module_names()
4893 if sys.platform == 'win32':
4894 modules.remove('multiprocessing.popen_fork')
4895 modules.remove('multiprocessing.popen_forkserver')
4896 modules.remove('multiprocessing.popen_spawn_posix')
4897 else:
4898 modules.remove('multiprocessing.popen_spawn_win32')
4899 if not HAS_REDUCTION:
4900 modules.remove('multiprocessing.popen_forkserver')
4901
4902 if c_int is None:
4903 # This module requires _ctypes
4904 modules.remove('multiprocessing.sharedctypes')
4905
4906 for name in modules:
4907 __import__(name)
4908 mod = sys.modules[name]
4909 self.assertTrue(hasattr(mod, '__all__'), name)
4910
4911 for attr in mod.__all__:
4912 self.assertTrue(
4913 hasattr(mod, attr),
4914 '%r does not have attribute %r' % (mod, attr)
4915 )
4916
4917#
4918# Quick test that logging works -- does not test logging output

Callers

nothing calls this directly

Calls 5

get_module_namesMethod · 0.95
hasattrFunction · 0.85
assertTrueMethod · 0.80
__import__Function · 0.50
removeMethod · 0.45

Tested by

no test coverage detected