summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio/test_unix_events.py
diff options
context:
space:
mode:
authorxdegaye <xdegaye@gmail.com>2017-11-24 16:35:55 (GMT)
committerGitHub <noreply@github.com>2017-11-24 16:35:55 (GMT)
commit0f86cd38f4a38f25a4aed3759a654a4b7fa49031 (patch)
treedbf1b69d6ba27e7ff77221cd97ebae60ee962a61 /Lib/test/test_asyncio/test_unix_events.py
parent19fb134185ce155bc53f517116fca73093ba55e9 (diff)
downloadcpython-0f86cd38f4a38f25a4aed3759a654a4b7fa49031.zip
cpython-0f86cd38f4a38f25a4aed3759a654a4b7fa49031.tar.gz
cpython-0f86cd38f4a38f25a4aed3759a654a4b7fa49031.tar.bz2
bpo-28684: asyncio tests handle PermissionError raised on binding unix sockets (GH-4503)
The test.support.skip_unless_bind_unix_socket() decorator is used to skip asyncio tests that fail because the platform lacks a functional bind() function for unix domain sockets (as it is the case for non root users on the recent Android versions that run now SELinux in enforcing mode).
Diffstat (limited to 'Lib/test/test_asyncio/test_unix_events.py')
-rw-r--r--Lib/test/test_asyncio/test_unix_events.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_unix_events.py b/Lib/test/test_asyncio/test_unix_events.py
index fe758ba..04284fa 100644
--- a/Lib/test/test_asyncio/test_unix_events.py
+++ b/Lib/test/test_asyncio/test_unix_events.py
@@ -13,6 +13,7 @@ import tempfile
import threading
import unittest
from unittest import mock
+from test import support
if sys.platform == 'win32':
raise unittest.SkipTest('UNIX only')
@@ -239,6 +240,7 @@ class SelectorEventLoopUnixSocketTests(test_utils.TestCase):
self.loop = asyncio.SelectorEventLoop()
self.set_event_loop(self.loop)
+ @support.skip_unless_bind_unix_socket
def test_create_unix_server_existing_path_sock(self):
with test_utils.unix_socket_path() as path:
sock = socket.socket(socket.AF_UNIX)
@@ -251,6 +253,7 @@ class SelectorEventLoopUnixSocketTests(test_utils.TestCase):
srv.close()
self.loop.run_until_complete(srv.wait_closed())
+ @support.skip_unless_bind_unix_socket
def test_create_unix_server_pathlib(self):
with test_utils.unix_socket_path() as path:
path = pathlib.Path(path)
@@ -308,6 +311,7 @@ class SelectorEventLoopUnixSocketTests(test_utils.TestCase):
@unittest.skipUnless(hasattr(socket, 'SOCK_NONBLOCK'),
'no socket.SOCK_NONBLOCK (linux only)')
+ @support.skip_unless_bind_unix_socket
def test_create_unix_server_path_stream_bittype(self):
sock = socket.socket(
socket.AF_UNIX, socket.SOCK_STREAM | socket.SOCK_NONBLOCK)