summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_poll.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_poll.py')
-rw-r--r--Lib/test/test_poll.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/Lib/test/test_poll.py b/Lib/test/test_poll.py
index 445032d..ef966bf 100644
--- a/Lib/test/test_poll.py
+++ b/Lib/test/test_poll.py
@@ -83,13 +83,12 @@ class PollTests(unittest.TestCase):
r = p.poll()
self.assertEqual(r[0], (FD, select.POLLNVAL))
- f = open(TESTFN, 'w')
- fd = f.fileno()
- p = select.poll()
- p.register(f)
- r = p.poll()
- self.assertEqual(r[0][0], fd)
- f.close()
+ with open(TESTFN, 'w') as f:
+ fd = f.fileno()
+ p = select.poll()
+ p.register(f)
+ r = p.poll()
+ self.assertEqual(r[0][0], fd)
r = p.poll()
self.assertEqual(r[0], (fd, select.POLLNVAL))
os.unlink(TESTFN)