Skip to content

Commit 1127b31

Browse files
i2yvasily-v-ryabov
authored andcommitted
Change a test behavior for unix_connect.get_socket
1 parent 06cd821 commit 1127b31

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

test/test_unix_connect.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ def _get_socket(socket_type, raises, *params):
7272
def path_exists(returns, path):
7373
calls.append(('os.path.exists', path))
7474
return returns
75-
def fcntl(*args):
76-
calls.append(('fcntl',) + args)
75+
def ensure_not_inheritable(*args):
76+
calls.append(('ensure_not_inheritable',) + args)
7777
for params, allow_unix, unix_addr_exists, allow_tcp, expect_connection_error, expected_calls in (
7878
# Successful explicit TCP socket connection.
7979
(('tcp/host:6', None, 'host', 6), False, False, True, False, [
@@ -141,17 +141,15 @@ def fcntl(*args):
141141
partial(_get_socket, 'tcp', not allow_tcp)), \
142142
patch('os.path.exists',
143143
partial(path_exists, unix_addr_exists)), \
144-
patch('fcntl.fcntl', fcntl):
144+
patch('Xlib.support.unix_connect._ensure_not_inheritable', ensure_not_inheritable):
145145
del calls[:]
146146
if expect_connection_error:
147147
with self.assertRaises(DisplayConnectionError):
148148
unix_connect.get_socket(*params)
149149
else:
150150
s = unix_connect.get_socket(*params)
151151
self.assertIsInstance(s, FakeSocket)
152-
expected_calls.append(('fcntl', 42,
153-
unix_connect.F_SETFD,
154-
unix_connect.FD_CLOEXEC))
152+
expected_calls.append(('ensure_not_inheritable', s))
155153
self.assertEqual(calls, expected_calls)
156154

157155

0 commit comments

Comments
 (0)