]> granicus.if.org Git - python/commitdiff
Broke reference loops in tests added in issue #5700.
authorSerhiy Storchaka <storchaka@gmail.com>
Sun, 22 Feb 2015 22:28:38 +0000 (00:28 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Sun, 22 Feb 2015 22:28:38 +0000 (00:28 +0200)
Lib/test/test_io.py

index 79cd87b45ff8c745e5e512a4e1ff40544ff603df..668b023e48958bd767371fab689e27e66059c6ac 100644 (file)
@@ -606,6 +606,7 @@ class IOTest(unittest.TestCase):
         self.assertTrue(f.closed)
         self.assertTrue(closed)      # flush() called
         self.assertFalse(closed[0])  # flush() called before file closed
+        f.flush = lambda: None  # break reference loop
 
     def test_flush_error_on_close(self):
         # raw file
@@ -833,6 +834,7 @@ class CommonBufferedTests:
         self.assertTrue(closed)      # flush() called
         self.assertFalse(closed[0])  # flush() called before file closed
         self.assertFalse(closed[1])
+        raw.flush = lambda: None  # break reference loop
 
     def test_close_error_on_close(self):
         raw = self.MockRawIO()
@@ -2670,6 +2672,7 @@ class TextIOWrapperTest(unittest.TestCase):
         self.assertTrue(closed)      # flush() called
         self.assertFalse(closed[0])  # flush() called before file closed
         self.assertFalse(closed[1])
+        txt.flush = lambda: None  # break reference loop
 
     def test_close_error_on_close(self):
         buffer = self.BytesIO(self.testdata)