diff options
author | xdegaye <xdegaye@gmail.com> | 2019-05-03 15:09:17 (GMT) |
---|---|---|
committer | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-05-03 15:09:17 (GMT) |
commit | 4461d704e23a13dfbe78ea3020e4cbeff4b68dc2 (patch) | |
tree | c1747fb1ab5906ff40a41308d9221f0d39139bd2 /Lib/test/test_socket.py | |
parent | a8a79cacca4a03e2e682bf10108c80f502791755 (diff) | |
download | cpython-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.py | 9 |
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"): |