예제 #1
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'>'")
예제 #2
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'>'"
예제 #3
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'>'"
예제 #4
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'>'")
예제 #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'>'")
예제 #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'>'")
예제 #7
0
 def test_module_repr(self):
     resolver = Resolver()
     repr_str = resolver.module_repr(tests.watson.common)
     assert repr_str.startswith("<module 'tests.watson.common'")
예제 #8
0
 def test_find_module(self):
     resolver = Resolver('test')
     result = resolver.find_module('test.module')
     assert result == resolver
     result = resolver.find_module('something')
     assert not result
예제 #9
0
 def test_resolver_registration(self):
     resolver = Resolver('test')
     assert resolver in sys.meta_path
     resolver.deregister()
     assert resolver not in sys.meta_path
예제 #10
0
 def test_find_module(self):
     resolver = Resolver("test")
     result = resolver.find_module("test.module")
     assert result == resolver
     result = resolver.find_module("something")
     assert not result
예제 #11
0
 def test_module_repr(self):
     resolver = Resolver()
     repr_str = resolver.module_repr(tests.watson.common)
     assert repr_str.startswith("<module 'tests.watson.common'")
예제 #12
0
 def test_find_module(self):
     resolver = Resolver('test')
     result = resolver.find_module('test.module')
     assert result == resolver
     result = resolver.find_module('something')
     assert not result
예제 #13
0
 def test_resolver_registration(self):
     resolver = Resolver('test')
     assert resolver in sys.meta_path
     resolver.deregister()
     assert resolver not in sys.meta_path
예제 #14
0
# -*- coding: utf-8 -*-
from watson.common.imports import Resolver

__version__ = '0.2.1'

Resolver('watson')