Exemple #1
0
 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)
Exemple #2
0
 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)
Exemple #3
0
 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)
Exemple #5
0
 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
Exemple #6
0
 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
Exemple #7
0
 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))
Exemple #8
0
 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))
Exemple #9
0
    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