summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_ioctl.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-06-30 16:20:11 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-06-30 16:20:11 (GMT)
commita6d2c769fb38129b6654f8e4ad5b6b27af182f2c (patch)
treed45f5ca3e8633072da875d9944012f644d440bc3 /Lib/test/test_ioctl.py
parenteaf399e3355e6d62b1bb5810b66ad4ff431ece57 (diff)
downloadcpython-a6d2c769fb38129b6654f8e4ad5b6b27af182f2c.zip
cpython-a6d2c769fb38129b6654f8e4ad5b6b27af182f2c.tar.gz
cpython-a6d2c769fb38129b6654f8e4ad5b6b27af182f2c.tar.bz2
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.
Diffstat (limited to 'Lib/test/test_ioctl.py')
-rw-r--r--Lib/test/test_ioctl.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/test/test_ioctl.py b/Lib/test/test_ioctl.py
index d4d5a22..531c9af 100644
--- a/Lib/test/test_ioctl.py
+++ b/Lib/test/test_ioctl.py
@@ -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)