[pypy-commit] pypy py3.5: Fixed tests from own own-win-x86-32
andrewjlawrence
pypy.commits at gmail.com
Sat Sep 29 01:09:51 EDT 2018
Author: andrewjlawrence
Branch: py3.5
Changeset: r95171:251058ac9cef
Date: 2018-09-19 18:55 +0100
http://bitbucket.org/pypy/pypy/changeset/251058ac9cef/
Log: Fixed tests from own own-win-x86-32 pypy.module._io.test.test_fileio
AppTestFileIO.().test_FileIO_fd_does_not_change_inheritable
pypy.module._io.test.test_fileio
AppTestFileIO.().test_close_upon_reinit
pypy.module._io.test.test_fileio
AppTestFileIO.().test_non_inheritable
Modified FileIO descrinit to set inheritable to false on windows
diff --git a/pypy/module/_io/interp_fileio.py b/pypy/module/_io/interp_fileio.py
--- a/pypy/module/_io/interp_fileio.py
+++ b/pypy/module/_io/interp_fileio.py
@@ -202,6 +202,12 @@
except OSError as e:
raise wrap_oserror2(space, e, w_name,
eintr_retry=False)
+ else:
+ try:
+ rposix.set_inheritable(self.fd, False)
+ except OSError as e:
+ raise wrap_oserror2(space, e, w_name,
+ eintr_retry=False)
else:
w_fd = space.call_function(w_opener, w_name,
space.newint(flags))
@@ -225,6 +231,7 @@
raise wrap_oserror2(space, e, w_name,
eintr_retry=False)
+
try:
st = os.fstat(self.fd)
except OSError as e:
diff --git a/pypy/module/_io/test/test_fileio.py b/pypy/module/_io/test/test_fileio.py
--- a/pypy/module/_io/test/test_fileio.py
+++ b/pypy/module/_io/test/test_fileio.py
@@ -279,31 +279,34 @@
raises(FileExistsError, _io.FileIO, filename, 'x')
def test_non_inheritable(self):
- import _io, posix
+ import _io
+ os = self.posix
f = _io.FileIO(self.tmpfile, 'r')
- assert posix.get_inheritable(f.fileno()) == False
+ assert os.get_inheritable(f.fileno()) == False
f.close()
def test_FileIO_fd_does_not_change_inheritable(self):
- import _io, posix
- fd1, fd2 = posix.pipe()
- posix.set_inheritable(fd1, True)
- posix.set_inheritable(fd2, False)
+ import _io
+ os = self.posix
+ fd1, fd2 = os.pipe()
+ os.set_inheritable(fd1, True)
+ os.set_inheritable(fd2, False)
f1 = _io.FileIO(fd1, 'r')
f2 = _io.FileIO(fd2, 'w')
- assert posix.get_inheritable(fd1) == True
- assert posix.get_inheritable(fd2) == False
+ assert os.get_inheritable(fd1) == True
+ assert os.get_inheritable(fd2) == False
f1.close()
f2.close()
def test_close_upon_reinit(self):
- import _io, posix
+ import _io
+ os = self.posix
f = _io.FileIO(self.tmpfile, 'r')
fd1 = f.fileno()
f.__init__(self.tmpfile, 'w')
fd2 = f.fileno()
if fd1 != fd2:
- raises(OSError, posix.close, fd1)
+ raises(OSError, os.close, fd1)
def test_opener_negative(self):
import _io
More information about the pypy-commit
mailing list