summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_os.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-06-30 16:21:39 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-06-30 16:21:39 (GMT)
commit2f655b73e4903a218e09cb4c58f7a2b8a706582a (patch)
treead17879220d57e7b4048d175d03f9316c02f25f7 /Lib/test/test_os.py
parent3909da7fca2ef92b8483f39b7cf89cac4b6e4826 (diff)
parenta6d2c769fb38129b6654f8e4ad5b6b27af182f2c (diff)
downloadcpython-2f655b73e4903a218e09cb4c58f7a2b8a706582a.zip
cpython-2f655b73e4903a218e09cb4c58f7a2b8a706582a.tar.gz
cpython-2f655b73e4903a218e09cb4c58f7a2b8a706582a.tar.bz2
(merge 3.2) 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_os.py')
-rw-r--r--Lib/test/test_os.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index 13dc337..0f2aedf 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -694,12 +694,11 @@ class MakedirTests(unittest.TestCase):
class DevNullTests(unittest.TestCase):
def test_devnull(self):
- f = open(os.devnull, 'w')
- f.write('hello')
- f.close()
- f = open(os.devnull, 'r')
- self.assertEqual(f.read(), '')
- f.close()
+ with open(os.devnull, 'wb') as f:
+ f.write(b'hello')
+ f.close()
+ with open(os.devnull, 'rb') as f:
+ self.assertEqual(f.read(), b'')
class URandomTests(unittest.TestCase):
def test_urandom(self):
@@ -1049,7 +1048,7 @@ if sys.platform != 'win32':
def test_open(self):
for fn in self.unicodefn:
- f = open(os.path.join(self.dir, fn))
+ f = open(os.path.join(self.dir, fn), 'rb')
f.close()
def test_stat(self):