def tearDown(self): channelsNames = channels._cache.keys() classesNames = channels._registry.keys() for channelName in channelsNames: if channelName not in self.existingChannels: channels.remove(channelName) for className in classesNames: if className not in self.registeredClasses: del channels._registry[className] for channelName in self.configChannels: settings.remove(channels.CONFIG_NAME, channelName)
def testRemove(self): channel = TestClass1("Test") channels._cache[channel.name] = channel self.assertEqual(None, channels.remove("TestName")) self.assertEqual(channel, channels.remove("Test")) self.assertFalse(channel.name in channels._cache)