diff --git a/Lib/test/test_asyncore.py b/Lib/test/test_asyncore.py index 62173340299..d5e6fa3a016 100644 --- a/Lib/test/test_asyncore.py +++ b/Lib/test/test_asyncore.py @@ -398,7 +398,8 @@ class DispatcherWithSendTests_UsePoll(DispatcherWithSendTests): class FileWrapperTest(unittest.TestCase): def setUp(self): self.d = "It's not dead, it's sleeping!" - file(TESTFN, 'w').write(self.d) + with file(TESTFN, 'w') as h: + h.write(self.d) def tearDown(self): unlink(TESTFN)