Commit eace7fc4 authored by Serhiy Storchaka's avatar Serhiy Storchaka

Issue #18919: Fixed resource leaks in audio tests.

parent 5ffda43e
......@@ -141,13 +141,13 @@ class AudioTestsWithSourceFile(AudioTests):
self.sndfilenframes, self.comptype, self.compname)
def test_close(self):
testfile = open(self.sndfilepath, 'rb')
with open(self.sndfilepath, 'rb') as testfile:
f = self.f = self.module.open(testfile)
self.assertFalse(testfile.closed)
f.close()
self.assertEqual(testfile.closed, self.close_fd)
testfile = open(TESTFN, 'wb')
fout = self.module.open(testfile, 'wb')
with open(TESTFN, 'wb') as testfile:
fout = self.fout = self.module.open(testfile, 'wb')
self.assertFalse(testfile.closed)
with self.assertRaises(self.module.Error):
fout.close()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment