Exemplo n.º 1
0
    def test_reload_missing_loader(self):
        with support.CleanImport('types'):
            import types
            loader = types.__loader__
            del types.__loader__
            reloaded = self.init.reload(types)

            self.assertIs(reloaded, types)
            self.assertIs(sys.modules['types'], types)
            self.assertEqual(reloaded.__loader__.path, loader.path)
Exemplo n.º 2
0
    def test_reload_loader_replaced(self):
        with support.CleanImport('types'):
            import types
            types.__loader__ = None
            self.init.invalidate_caches()
            reloaded = self.init.reload(types)

            self.assertIsNot(reloaded.__loader__, None)
            self.assertIs(reloaded, types)
            self.assertIs(sys.modules['types'], types)
 def test_multiple_features(self):
     with support.CleanImport("test.test_future5"):
         from sql_mode import test_future5
Exemplo n.º 4
0
 def test_reload_modules(self):
     for mod in ('tokenize', 'time', 'marshal'):
         with self.subTest(module=mod):
             with support.CleanImport(mod):
                 module = self.init.import_module(mod)
                 self.init.reload(module)
 def test_future3(self):
     with support.CleanImport('test_future3'):
         from sql_mode import test_future3
 def test_future2(self):
     with support.CleanImport('future_test2'):
         from sql_mode import future_test2
         self.assertEqual(future_test2.result, 6)
Exemplo n.º 7
0
 def test_CleanImport(self):
     import importlib
     with support.CleanImport("asyncore"):
         importlib.import_module("asyncore")
 def test_builtin(self):
     with support.CleanImport('marshal'):
         import marshal
         imp.reload(marshal)
 def test_extension(self):
     with support.CleanImport('time'):
         import time
         imp.reload(time)