diff options
author | Collin Winter <collinw@gmail.com> | 2007-09-01 20:29:04 +0000 |
---|---|---|
committer | Collin Winter <collinw@gmail.com> | 2007-09-01 20:29:04 +0000 |
commit | 5118aea20e0c0d43d7e74f5c4bf4a2b5b10d699e (patch) | |
tree | 19eab4e544735c7edaefeeeab496ef2e09805dc0 /Lib/test/test_with.py | |
parent | a1c2dada017abc9e45d1fff82addcc953ab4efb1 (diff) | |
download | cpython-5118aea20e0c0d43d7e74f5c4bf4a2b5b10d699e.tar.gz |
Fix refleaks in test_with caused by reusing the same exception instance over and over.
Diffstat (limited to 'Lib/test/test_with.py')
-rw-r--r-- | Lib/test/test_with.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/test/test_with.py b/Lib/test/test_with.py index 4fc8fe9fca..a7bc2068b4 100644 --- a/Lib/test/test_with.py +++ b/Lib/test/test_with.py @@ -187,7 +187,9 @@ class FailureTestCase(unittest.TestCase): self.assertRaises(RuntimeError, shouldThrow) class ContextmanagerAssertionMixin(object): - TEST_EXCEPTION = RuntimeError("test exception") + + def setUp(self): + self.TEST_EXCEPTION = RuntimeError("test exception") def assertInWithManagerInvariants(self, mock_manager): self.assertTrue(mock_manager.enter_called) @@ -353,7 +355,7 @@ class NestedNonexceptionalTestCase(unittest.TestCase, self.assertAfterWithManagerInvariantsNoError(mock_nested) -class ExceptionalTestCase(unittest.TestCase, ContextmanagerAssertionMixin): +class ExceptionalTestCase(ContextmanagerAssertionMixin, unittest.TestCase): def testSingleResource(self): cm = mock_contextmanager_generator() def shouldThrow(): |