def test_containers(self): import suppression parents = util.getPythonContainers( suppression.TestSuppression2.testSuppressModule) expected = [suppression.TestSuppression2, suppression] for a, b in zip(parents, expected): self.failUnlessEqual(a, b)
def test_containers(self): """ When pased a test case, L{util.getPythonContainers} returns a list including the test case and the module the test case is defined in. """ parents = util.getPythonContainers(suppression.SynchronousTestSuppression2.testSuppressModule) expected = [suppression.SynchronousTestSuppression2, suppression] for a, b in zip(parents, expected): self.assertEqual(a, b)
def test_containers(self): """ When pased a test case, L{util.getPythonContainers} returns a list including the test case and the module the test case is defined in. """ parents = util.getPythonContainers( suppression.SynchronousTestSuppression2.testSuppressModule) expected = [suppression.SynchronousTestSuppression2, suppression] for a, b in zip(parents, expected): self.assertEqual(a, b)
def __init__(self, methodName=None): super(TestCase, self).__init__(methodName) self._testMethodName = methodName testMethod = getattr(self, methodName) self._parents = [testMethod, self] self._parents.extend(util.getPythonContainers(testMethod)) self._shared = hasattr(self, "setUpClass") or hasattr(self, "tearDownClass") if self._shared: self._prepareClassFixture() if not hasattr(self.__class__, "_instances"): self._initInstances() self.__class__._instances.add(self) self._passed = False
def __init__(self, methodName=None): super(TestCase, self).__init__(methodName) self._testMethodName = methodName testMethod = getattr(self, methodName) self._parents = [testMethod, self] self._parents.extend(util.getPythonContainers(testMethod)) self._shared = (hasattr(self, 'setUpClass') or hasattr(self, 'tearDownClass')) if self._shared: self._prepareClassFixture() if not hasattr(self.__class__, '_instances'): self._initInstances() self.__class__._instances.add(self) self._passed = False
def test_containers(self): """ When pased a test case, L{util.getPythonContainers} returns a list including the test case and the module the test case is defined in. """ parents = util.getPythonContainers( suppression.SynchronousTestSuppression2.testSuppressModule) expected = [suppression.SynchronousTestSuppression2, suppression] for a, b in zip(parents, expected): self.assertEqual(a, b) # Also, the function is deprecated. warnings = self.flushWarnings([self.test_containers]) self.assertEqual(DeprecationWarning, warnings[0]['category']) self.assertEqual( "twisted.trial.util.getPythonContainers was deprecated in " "Twisted 12.3.0: This function never worked correctly. " "Implement lookup on your own.", warnings[0]['message']) self.assertEqual(1, len(warnings))
def test_containers(self): """ When passed a test case, L{util.getPythonContainers} returns a list including the test case and the module the test case is defined in. """ parents = util.getPythonContainers( suppression.SynchronousTestSuppression2.testSuppressModule) expected = [suppression.SynchronousTestSuppression2, suppression] for a, b in zip(parents, expected): self.assertEqual(a, b) # Also, the function is deprecated. warnings = self.flushWarnings([self.test_containers]) self.assertEqual(DeprecationWarning, warnings[0]['category']) self.assertEqual( "twisted.trial.util.getPythonContainers was deprecated in " "Twisted 12.3.0: This function never worked correctly. " "Implement lookup on your own.", warnings[0]['message']) self.assertEqual(1, len(warnings))
def __init__(self, methodName='runTest'): """ Construct an asynchronous test case for C{methodName}. @param methodName: The name of a method on C{self}. This method should be a unit test. That is, it should be a short method that calls some of the assert* methods. If C{methodName} is unspecified, L{runTest} will be used as the test method. This is mostly useful for testing Trial. """ super(TestCase, self).__init__(methodName) self._testMethodName = methodName testMethod = getattr(self, methodName) self._parents = [testMethod, self] self._parents.extend(util.getPythonContainers(testMethod)) self._shared = (hasattr(self, 'setUpClass') or hasattr(self, 'tearDownClass')) if self._shared: self._prepareClassFixture() if not hasattr(self.__class__, '_instances'): self._initInstances() self.__class__._instances.add(self) self._passed = False self.forceGarbageCollection = False