summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_socket.py
diff options
context:
space:
mode:
authorxdegaye <xdegaye@gmail.com>2019-05-03 15:09:17 (GMT)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-05-03 15:09:17 (GMT)
commit4461d704e23a13dfbe78ea3020e4cbeff4b68dc2 (patch)
treec1747fb1ab5906ff40a41308d9221f0d39139bd2 /Lib/test/test_socket.py
parenta8a79cacca4a03e2e682bf10108c80f502791755 (diff)
downloadcpython-4461d704e23a13dfbe78ea3020e4cbeff4b68dc2.zip
cpython-4461d704e23a13dfbe78ea3020e4cbeff4b68dc2.tar.gz
cpython-4461d704e23a13dfbe78ea3020e4cbeff4b68dc2.tar.bz2
bpo-36341: Fix tests calling bind() on AF_UNIX sockets (GH-12399)
Those tests may fail with PermissionError. https://bugs.python.org/issue36341
Diffstat (limited to 'Lib/test/test_socket.py')
-rw-r--r--Lib/test/test_socket.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index 815f9ad..0094cec 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -1796,8 +1796,13 @@ class GeneralModuleTests(unittest.TestCase):
self.addCleanup(shutil.rmtree, tmpdir)
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
self.addCleanup(s.close)
- s.bind(os.path.join(tmpdir, 'socket'))
- self._test_socket_fileno(s, socket.AF_UNIX, socket.SOCK_STREAM)
+ try:
+ s.bind(os.path.join(tmpdir, 'socket'))
+ except PermissionError:
+ pass
+ else:
+ self._test_socket_fileno(s, socket.AF_UNIX,
+ socket.SOCK_STREAM)
def test_socket_fileno_rejects_float(self):
with self.assertRaisesRegex(TypeError, "integer argument expected"):