Exemplo n.º 1
0
 def test_load_module(self):
     resolver = Resolver("testing")
     module = imp.new_module("testing")
     module.__file__ = "testing.py"
     sys.modules["testing"] = module
     loaded = resolver.load_module("testing")
     assert module == loaded
     assert resolver.module_repr(loaded) == "<module 'testing' from 'testing.py'>'"
Exemplo n.º 2
0
 def test_load_nested_packages(self):
     resolver = Resolver("testing")
     module = imp.new_module("nested_testing.something.else")
     module.__file__ = "nested_testing/something/else.py"
     sys.modules["nested_testing.something.else"] = module
     loaded = resolver.load_module("nested.testing.something.else")
     assert module == loaded
     assert resolver.module_repr(loaded).endswith("aliased by 'nested.testing.something.else'>'")
Exemplo n.º 3
0
 def test_load_package(self):
     resolver = Resolver("testing")
     module = imp.new_module("testing_something")
     module.__file__ = "testing_something.py"
     sys.modules["testing_something"] = module
     loaded = resolver.load_module("testing.something")
     assert module == loaded
     assert resolver.module_repr(loaded).endswith("aliased by 'testing.something'>'")
Exemplo n.º 4
0
 def test_load_module(self):
     resolver = Resolver('testing')
     module = imp.new_module('testing')
     module.__file__ = 'testing.py'
     sys.modules['testing'] = module
     loaded = resolver.load_module('testing')
     assert module == loaded
     assert resolver.module_repr(loaded) == "<module 'testing' from 'testing.py'>'"
Exemplo n.º 5
0
 def test_load_nested_packages(self):
     resolver = Resolver('testing')
     module = imp.new_module('nested_testing.something.else')
     module.__file__ = 'nested_testing/something/else.py'
     sys.modules['nested_testing.something.else'] = module
     loaded = resolver.load_module('nested.testing.something.else')
     assert module == loaded
     assert resolver.module_repr(loaded).endswith("aliased by 'nested.testing.something.else'>'")
Exemplo n.º 6
0
 def test_load_package(self):
     resolver = Resolver('testing')
     module = imp.new_module('testing_something')
     module.__file__ = 'testing_something.py'
     sys.modules['testing_something'] = module
     loaded = resolver.load_module('testing.something')
     assert module == loaded
     assert resolver.module_repr(loaded).endswith("aliased by 'testing.something'>'")