def test_importlib_importmodule_class_from_relative_ns_subpkg_bytecode(self):
"""Verify that test class is importable relatively"""
print_importers()
assert __package__
# import_module checks sys.modules by itself
# but the test is not reflecting anything if we use the already loaded module.
if sys.modules.get(__package__ + '.nspkg.subpkg.bytecode'):
raise unittest.SkipTest("module previously loaded".format(__package__ + '.nspkg.subpkg.bytecode'))
else:
nspkg_subpkg_bytecode = importlib.import_module('.nspkg.subpkg.bytecode', package=__package__)
test_class_in_bytecode = nspkg_subpkg_bytecode.TestClassInBytecode
self.assertTrue(test_class_in_bytecode is not None)
self.assertTrue(callable(test_class_in_bytecode))
# TODO : implement some differences and check we get them...
if hasattr(importlib, 'reload'): # recent version of importlib
# attempting to reload
importlib.reload(nspkg_subpkg_bytecode)
else:
pass
test_filefinder2_importlib_importmodule.py 文件源码
python
阅读 16
收藏 0
点赞 0
评论 0
评论列表
文章目录