Skip to content

Commit a6dece8

Browse files
committed
change tests
1 parent 17ab8c0 commit a6dece8

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

tests/units/utils/test_processes.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,21 +116,19 @@ def test_is_process_on_port_permission_error():
116116
assert result is True
117117

118118

119-
@pytest.mark.parametrize("should_listen", [True, False])
120-
def test_is_process_on_port_concurrent_access(should_listen):
119+
def test_is_process_on_port_concurrent_access():
121120
"""Test is_process_on_port works correctly with concurrent access.
122121
123122
Args:
124123
should_listen: Whether the server socket should call listen() or just bind().
125124
"""
126125

127-
def create_server_and_test(port_holder, listen):
126+
def create_server_and_test(port_holder):
128127
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
129128
server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
130129
server.bind(("127.0.0.1", 0))
131130

132-
if listen:
133-
server.listen(1)
131+
server.listen(1)
134132

135133
port = server.getsockname()[1]
136134
port_holder[0] = port
@@ -140,9 +138,7 @@ def create_server_and_test(port_holder, listen):
140138
server.close()
141139

142140
port_holder = [None]
143-
thread = threading.Thread(
144-
target=create_server_and_test, args=(port_holder, should_listen)
145-
)
141+
thread = threading.Thread(target=create_server_and_test, args=(port_holder))
146142
thread.start()
147143

148144
# Wait a bit for the server to start

0 commit comments

Comments
 (0)