mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Use a file context manager for test_ioctl.
This commit is contained in:
parent
5a9e91b050
commit
dff69853af
1 changed files with 4 additions and 4 deletions
|
@ -30,10 +30,10 @@ class IoctlTests(unittest.TestCase):
|
|||
# If this process has been put into the background, TIOCGPGRP returns
|
||||
# the session ID instead of the process group id.
|
||||
ids = (os.getpgrp(), os.getsid(0))
|
||||
tty = open("/dev/tty", "r")
|
||||
r = fcntl.ioctl(tty, termios.TIOCGPGRP, " ")
|
||||
rpgrp = struct.unpack("i", r)[0]
|
||||
self.assertIn(rpgrp, ids)
|
||||
with open("/dev/tty", "r") as tty:
|
||||
r = fcntl.ioctl(tty, termios.TIOCGPGRP, " ")
|
||||
rpgrp = struct.unpack("i", r)[0]
|
||||
self.assertIn(rpgrp, ids)
|
||||
|
||||
def _check_ioctl_mutate_len(self, nbytes=None):
|
||||
buf = array.array('i')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue