[Python-Dev] cpython: Issue #18904: test_socket: add inheritance tests using fcntl and FD_CLOEXEC

Victor Stinner victor.stinner at gmail.com
Sun Sep 8 15:38:01 CEST 2013


2013/9/8 Antoine Pitrou <solipsis at pitrou.net>:
> On Sun,  8 Sep 2013 11:54:00 +0200 (CEST)
> victor.stinner <python-checkins at python.org> wrote:
>> http://hg.python.org/cpython/rev/b7f6f6f59e91
>> changeset:   85619:b7f6f6f59e91
>> user:        Victor Stinner <victor.stinner at gmail.com>
>> date:        Sun Sep 08 11:53:09 2013 +0200
>> summary:
>>   Issue #18904: test_socket: add inheritance tests using fcntl and FD_CLOEXEC
>>
> [...]
>>
>> +    if fcntl:
>> +        def test_get_inheritable_cloexec(self):
>
> The right way to do this would be to skip the test if fcntl doesn't
> exist.

Ok.

First, I added two methods to get and set the FD_CLOXEC flag. Later, I
inlined these methods because it makes the code more readable.

I modified the tests to use @unittest.skipIf decorator:

New changeset aea58e1cae75 by Victor Stinner in branch 'default':
Issue #18904: test_os and test_socket use unittest.skipIf() to check if fcntl
http://hg.python.org/cpython/rev/aea58e1cae75

Victor


More information about the Python-Dev mailing list