From f21dc94aa7733ebcf5503359c47c97beb458e094 Mon Sep 17 00:00:00 2001 From: Gustavo Niemeyer Date: Fri, 28 Mar 2008 19:39:41 -0300 Subject: When cleaning up on MockerTestCase, use reset() rather than restore(), so that the same test case instance may be run more than once (like Trial does). --- test.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test.py') diff --git a/test.py b/test.py index 173e51e..334407f 100755 --- a/test.py +++ b/test.py @@ -390,6 +390,17 @@ class MockerTestCaseTest(TestCase): self.assertEquals(len(result.failures), 1) self.assertTrue("BOOM!" in result.failures[0][1]) + del calls[:] + + result = unittest.TestResult() + # Running twice in the same instance (Trial does that). + test = MyTest("test_method") + test.run(result) + test.run(result) + + self.assertEquals(calls, ["verify", "restore", "verify", "restore"]) + self.assertTrue(result.wasSuccessful()) + def test_expectation_failure_acts_appropriately(self): class MyTest(MockerTestCase): def test_method(self): -- cgit v1.2.1