def test_decoratePreservesSuite(self):
     """
     Tests can be in non-standard suites. L{decorate} preserves the
     non-standard suites when it decorates the tests.
     """
     test = self.TestCase()
     suite = runner.DestructiveTestSuite([test])
     decorated = unittest.decorate(suite, unittest.TestDecorator)
     self.assertSuitesEqual(
         decorated,
         runner.DestructiveTestSuite([unittest.TestDecorator(test)]))
Ejemplo n.º 2
0
 def test_cleanup(self):
     """
     Checks that the test suite cleanups its tests during the run, so that
     it ends empty.
     """
     class MockTest(unittest.TestCase):
         def test_foo(test):
             pass
     test = MockTest('test_foo')
     result = reporter.TestResult()
     suite = runner.DestructiveTestSuite([test])
     self.assertEqual(suite.countTestCases(), 1)
     suite.run(result)
     self.assertEqual(suite.countTestCases(), 0)
Ejemplo n.º 3
0
 def test_basic(self):
     """
     Thes destructive test suite should run the tests normally.
     """
     called = []
     class MockTest(unittest.TestCase):
         def test_foo(test):
             called.append(True)
     test = MockTest('test_foo')
     result = reporter.TestResult()
     suite = runner.DestructiveTestSuite([test])
     self.assertEqual(called, [])
     suite.run(result)
     self.assertEqual(called, [True])
     self.assertEqual(suite.countTestCases(), 0)