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:
Victor Stinner 2011-06-30 18:20:11 +02:00
parent eaf399e335
commit a6d2c769fb
5 changed files with 16 additions and 18 deletions

View file

@ -62,7 +62,7 @@ class TestFcntl(unittest.TestCase):
def test_fcntl_fileno(self):
# the example from the library docs
self.f = open(TESTFN, 'w')
self.f = open(TESTFN, 'wb')
rv = fcntl.fcntl(self.f.fileno(), fcntl.F_SETFL, os.O_NONBLOCK)
if verbose:
print('Status from fcntl with O_NONBLOCK: ', rv)
@ -74,7 +74,7 @@ class TestFcntl(unittest.TestCase):
def test_fcntl_file_descriptor(self):
# again, but pass the file rather than numeric descriptor
self.f = open(TESTFN, 'w')
self.f = open(TESTFN, 'wb')
rv = fcntl.fcntl(self.f, fcntl.F_SETFL, os.O_NONBLOCK)
if sys.platform not in ['os2emx']:
rv = fcntl.fcntl(self.f, fcntl.F_SETLKW, lockdata)