Author: collin.winter
Date: Sat Sep 1 22:29:04 2007
New Revision: 57888
Modified:
python/branches/py3k/Lib/test/test_with.py
Log:
Fix refleaks in test_with caused by reusing the same exception instance over
and over.
Modified: python/branches/py3k/Lib/test/test_with.py
==============================================================================
--- python/branches/py3k/Lib/test/test_with.py (original)
+++ python/branches/py3k/Lib/test/test_with.py Sat Sep 1 22:29:04 2007
@@ -187,7 +187,9 @@
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 @@
self.assertAfterWithManagerInvariantsNoError(mock_nested)
-class ExceptionalTestCase(unittest.TestCase, ContextmanagerAssertionMixin):
+class ExceptionalTestCase(ContextmanagerAssertionMixin, unittest.TestCase):
def testSingleResource(self):
cm = mock_contextmanager_generator()
def shouldThrow():
_______________________________________________
Python-3000-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000-checkins