Charles-François Natali <neolo...@free.fr> added the comment:

(No Rietveld link):

+is_valid_fd(int fd)
[...]
+    dummy_fd = dup(fd);
+    if (dummy_fd < 0)
+        return 0;
+    close(dummy_fd);

Why not use fstat() instead (does Windows have fstat()? And dup()?).

+    @unittest.skipIf(os.name == 'nt', "test needs POSIX semantics")
+    def test_no_stdin(self):

It would maybe be more direct with skipUnless(os.name == 'posix').

Finally, it's not that important, but it could maybe be possible to factorize 
the code, i.e. make a helper function that takes a list of streams and defines 
the preexec() function and code to test those streams, and then just call:

def test_no_stdin(self):
    out, err = self._test_with_closed_streams(['stdin'])
    [...]

def test_no_streams(self):
    out, err = self._test_with_closed_streams(['stdin', 'stdout', 'stderr'])
    [...]

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue7111>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to