mirror of
https://github.com/python/cpython.git
synced 2025-11-24 20:30:18 +00:00
Issue #12451: Open files in binary mode in some tests when the text file is not
needed. Remove also an unused variable (blank) in test_threading.
This commit is contained in:
parent
eaf399e335
commit
a6d2c769fb
5 changed files with 16 additions and 18 deletions
|
|
@ -7,7 +7,7 @@ termios = import_module('termios')
|
|||
get_attribute(termios, 'TIOCGPGRP') #Can't run tests without this feature
|
||||
|
||||
try:
|
||||
tty = open("/dev/tty", "r")
|
||||
tty = open("/dev/tty", "rb")
|
||||
except IOError:
|
||||
raise unittest.SkipTest("Unable to open /dev/tty")
|
||||
else:
|
||||
|
|
@ -30,7 +30,7 @@ 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))
|
||||
with open("/dev/tty", "r") as tty:
|
||||
with open("/dev/tty", "rb") as tty:
|
||||
r = fcntl.ioctl(tty, termios.TIOCGPGRP, " ")
|
||||
rpgrp = struct.unpack("i", r)[0]
|
||||
self.assertIn(rpgrp, ids)
|
||||
|
|
@ -47,7 +47,7 @@ class IoctlTests(unittest.TestCase):
|
|||
self.assertEqual(len(buf) * intsize, nbytes) # sanity check
|
||||
else:
|
||||
buf.append(fill)
|
||||
with open("/dev/tty", "r") as tty:
|
||||
with open("/dev/tty", "rb") as tty:
|
||||
r = fcntl.ioctl(tty, termios.TIOCGPGRP, buf, 1)
|
||||
rpgrp = buf[0]
|
||||
self.assertEqual(r, 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue