Ejemplo n.º 1
0
 def testSysModulesEqualBeforeAndAfter(self):
     """Modules before and after usage of RBI should be equal."""
     before = sys.modules.copy()
     rbi = RollbackImporter()
     import mod_w_imports
     rbi.uninstall()
     self.assertEqual(before, sys.modules)
Ejemplo n.º 2
0
 def testSysModulesEqualBeforeAndAfter(self):
     """Modules before and after usage of RBI should be equal."""
     before = sys.modules.copy()
     rbi = RollbackImporter()
     import lib.test.mod_w_imports
     rbi.uninstall()
     self.assertEqual(before, sys.modules)
 def testRelativeImport(self):
     """Should remove relative import."""
     modname = "lib.test.mod_wo_imports"
     self._del_if_existent(modname)
     rbi = RollbackImporter()
     import mod_wo_imports
     self.assertTrue(sys.modules.has_key(modname))
     rbi.uninstall()
     self.assertFalse(sys.modules.has_key(modname))
Ejemplo n.º 4
0
 def testRelativeImport(self):
     """Should remove relative import."""
     modname = "lib.test.mod_wo_imports"
     self._del_if_existent(modname)
     rbi = RollbackImporter()
     import mod_wo_imports
     self.assertTrue(sys.modules.has_key(modname))
     rbi.uninstall()
     self.assertFalse(sys.modules.has_key(modname))
Ejemplo n.º 5
0
 def testSimpleImport(self):
     """Should remove simple import."""
     modname = "lib.test.mod_wo_imports"
     self._del_if_existent(modname)
     rbi = RollbackImporter()
     import lib.test.mod_wo_imports
     #self.assertTrue(sys.modules.has_key(modname))
     self.assertTrue(modname in sys.modules)
     rbi.uninstall()
     #self.assertFalse(sys.modules.has_key(modname))
     self.assertFalse(modname not in sys.modules)
 def testComplexImport(self):
     """Should remove import and import(s) of import."""
     modname1 = "lib.test.mod_w_imports"
     modname2 = "lib.test.mod_wo_imports"
     self._del_if_existent(modname1)
     self._del_if_existent(modname2)
     rbi = RollbackImporter()
     import lib.test.mod_w_imports
     self.assertTrue(sys.modules.has_key(modname2))
     rbi.uninstall()
     self.assertFalse(sys.modules.has_key(modname2))
Ejemplo n.º 7
0
 def testComplexImport(self):
     """Should remove import and import(s) of import."""
     modname1 = "lib.test.mod_w_imports"
     modname2 = "lib.test.mod_wo_imports"
     self._del_if_existent(modname1)
     self._del_if_existent(modname2)
     rbi = RollbackImporter()
     import lib.test.mod_w_imports
     self.assertTrue(sys.modules.has_key(modname2))
     rbi.uninstall()
     self.assertFalse(sys.modules.has_key(modname2))