Commits

Michael Foord  committed 3d33f92

Remove explicit implementation of empty setUp / tearDown methods

  • Participants
  • Parent commits 15e0b9a

Comments (0)

Files changed (2)

File unittest2/case.py

         Cleanup items are called even if setUp fails (unlike tearDown)."""
         self._cleanups.append((function, args, kwargs))
 
-    def setUp(self):
-        "Hook method for setting up the test fixture before exercising it."
-
     @classmethod
     def setUpClass(cls):
         "Hook method for setting up class fixture before running tests in the class."
     def tearDownClass(cls):
         "Hook method for deconstructing the class fixture after running all tests in the class."
 
-    def tearDown(self):
-        "Hook method for deconstructing the test fixture after testing it."
-
-    def countTestCases(self):
-        return 1
-
     def defaultTestResult(self):
         return result.TestResult()
 

File unittest2/test/test_new_tests.py

         self.assertEqual(result.testsRun, 1)
         self.assertEqual(len(result.errors), 0)
 
+    def test_multiple_inheritance_setup(self):
+        test = self
+        test.setup_called = False
+        test.teardown_called = False
+
+        class OtherOther(unittest2.TestCase):
+            def setUp(self):
+                test.setup_called = True
+                super(OtherOther, self).setUp()
+            def tearDown(self):
+                test.teardown_called = True
+                super(OtherOther, self).setUp()
+
+        class Other(unittest2.TestCase):
+            pass
+
+        class Both(Other, OtherOther):
+            pass
+
+        Both('assert_').setUp()
+        Both('assert_').tearDown()
+        self.assertTrue(test.setup_called)
+        self.assertTrue(test.teardown_called)
+
 
 if __name__ == '__main__':
     unittest2.main()