예제 #1
0
 def __enter__(self):
     polyloader.reset()
     self.path = copy.copy(sys.path)
     self.path_hooks = copy.copy(sys.path_hooks)
     self.meta_path = copy.copy(sys.meta_path)
     self.modules = copy.copy(sys.modules)
     self.path_importer_cache = copy.copy(sys.path_importer_cache)
     return sys
예제 #2
0
 def test_reset_after_import(self):
     with ImportEnvironment() as sys:
         polyloader.install(compiler("2"), ['2'])
         polyloader.install(compiler("3"), ['3'])
         from tests_py2.polytestmix.test3 import result as result3
         polyloader.reset()
         with pytest.raises(ImportError):
             from tests_py2.polytestmix.test2 import result as result2
예제 #3
0
 def __enter__(self):
     polyloader.reset()
     self.path = copy.copy(sys.path)
     self.path_hooks = copy.copy(sys.path_hooks)
     self.meta_path = copy.copy(sys.meta_path)
     self.modules = copy.copy(sys.modules)
     self.path_importer_cache = copy.copy(sys.path_importer_cache)
     return sys
예제 #4
0
 def __enter__(self):
     polyloader.reset()
     self.path = copy.copy(sys.path)
     self.path_hooks = copy.copy(sys.path_hooks)
     self.meta_path = copy.copy(sys.meta_path)
     self.modules = copy.copy(sys.modules)
     self.path_importer_cache = copy.copy(sys.path_importer_cache)
     self.dont_write_bytecode = sys.dont_write_bytecode
     sys.dont_write_bytecode = True
     return sys