mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
bpo-36341: Fix tests calling bind() on AF_UNIX sockets (GH-12399)
Those tests may fail with PermissionError. https://bugs.python.org/issue36341
This commit is contained in:
parent
a8a79cacca
commit
4461d704e2
4 changed files with 13 additions and 5 deletions
|
@ -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"):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue