summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio/test_streams.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_streams.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_streams.py')
-rw-r--r--Lib/test/test_asyncio/test_streams.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/test/test_asyncio/test_streams.py b/Lib/test/test_asyncio/test_streams.py
index 6d16d20..a1e5bd7 100644
--- a/Lib/test/test_asyncio/test_streams.py
+++ b/Lib/test/test_asyncio/test_streams.py
@@ -9,6 +9,7 @@ import sys
import threading
import unittest
from unittest import mock
+from test import support
try:
import ssl
except ImportError:
@@ -57,7 +58,7 @@ class StreamReaderTests(test_utils.TestCase):
loop=self.loop)
self._basetest_open_connection(conn_fut)
- @unittest.skipUnless(hasattr(socket, 'AF_UNIX'), 'No UNIX Sockets')
+ @support.skip_unless_bind_unix_socket
def test_open_unix_connection(self):
with test_utils.run_test_unix_server() as httpd:
conn_fut = asyncio.open_unix_connection(httpd.address,
@@ -86,8 +87,8 @@ class StreamReaderTests(test_utils.TestCase):
self._basetest_open_connection_no_loop_ssl(conn_fut)
+ @support.skip_unless_bind_unix_socket
@unittest.skipIf(ssl is None, 'No ssl module')
- @unittest.skipUnless(hasattr(socket, 'AF_UNIX'), 'No UNIX Sockets')
def test_open_unix_connection_no_loop_ssl(self):
with test_utils.run_test_unix_server(use_ssl=True) as httpd:
conn_fut = asyncio.open_unix_connection(
@@ -113,7 +114,7 @@ class StreamReaderTests(test_utils.TestCase):
loop=self.loop)
self._basetest_open_connection_error(conn_fut)
- @unittest.skipUnless(hasattr(socket, 'AF_UNIX'), 'No UNIX Sockets')
+ @support.skip_unless_bind_unix_socket
def test_open_unix_connection_error(self):
with test_utils.run_test_unix_server() as httpd:
conn_fut = asyncio.open_unix_connection(httpd.address,
@@ -634,7 +635,7 @@ class StreamReaderTests(test_utils.TestCase):
server.stop()
self.assertEqual(msg, b"hello world!\n")
- @unittest.skipUnless(hasattr(socket, 'AF_UNIX'), 'No UNIX Sockets')
+ @support.skip_unless_bind_unix_socket
def test_start_unix_server(self):
class MyServer: