Add a test that uvloop doesn't set FD_CLOEXEC to stdin/stdout/stderr

Issue #40.
This commit is contained in:
Yury Selivanov 2016-07-09 12:49:27 -04:00
parent af4ab228dc
commit 575f71bdbe
1 changed files with 7 additions and 0 deletions

View File

@ -1,4 +1,5 @@
import asyncio import asyncio
import fcntl
import logging import logging
import threading import threading
import time import time
@ -505,6 +506,12 @@ class TestBaseUV(_TestBase, UVTestCase):
self.assertIs(fut._loop, self.loop) self.assertIs(fut._loop, self.loop)
fut.cancel() fut.cancel()
def test_loop_std_files_cloexec(self):
# See https://github.com/MagicStack/uvloop/issues/40 for details.
for fd in {0, 1, 2}:
flags = fcntl.fcntl(fd, fcntl.F_GETFD)
self.assertFalse(flags & fcntl.FD_CLOEXEC)
class TestBaseAIO(_TestBase, AIOTestCase): class TestBaseAIO(_TestBase, AIOTestCase):
pass pass