def testUninstall(self): self.assertFalse(hasattr(sys, "quickimport_cache")) q.install("off") self.assertFalse(hasattr(sys, "quickimport_cache")) self.assertListEqual(self.origSysPath, sys.path) self.assertListEqual(self.origPathHooks, sys.path_hooks) self.assertDictEqual(self.origPIC, sys.path_importer_cache) q.install() self.assertTrue(hasattr(sys, "quickimport_cache")) self.assertTrue(sys.quickimport_cache[q.AUTOCHACHE_KEY]) self.assertListEqual(self.origSysPath, sys.path) q.uninstall() self.assertFalse(hasattr(sys, "quickimport_cache")) self.assertListEqual(self.origSysPath, sys.path) self.assertListEqual(self.origPathHooks, sys.path_hooks) self.assertDictEqual(sys.path_importer_cache, {})
def tearDown(self): q.uninstall() sys.path[:] = self.origSysPath sys.path_hooks[:] = self.origPathHooks sys.path_importer_cache.clear() sys.path_importer_cache.update(self.origPIC)