Skip to content

Commit

Permalink
Clean up test
Browse files Browse the repository at this point in the history
  • Loading branch information
BCSharp committed Dec 23, 2024
1 parent d63ed31 commit 212b51c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Tests/modules/network_related/test__socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,14 +533,14 @@ def test_misc(self):
def test_makefile_refcount(self):
"Ensures that the _socket stays open while there's still a file associated"

GPORT = None
PORT = None
def echoer():
nonlocal GPORT
nonlocal PORT
s = socket.socket()
s.settimeout(15) # prevents the server from staying open if the client never connects
s.bind(('localhost', 0))
s.listen(5)
GPORT = s.getsockname()[1]
PORT = s.getsockname()[1]
(s2, _) = s.accept()
s2.send(s2.recv(10))
s2.close()
Expand All @@ -549,7 +549,7 @@ def echoer():
_thread.start_new_thread(echoer, ())
for _ in range(20):
time.sleep(0.5)
if GPORT is not None:
if PORT is not None:
break

if is_mono:
Expand All @@ -558,7 +558,7 @@ def echoer():
s = socket.socket()
if is_mono:
dummy.close()
s.connect(('localhost', GPORT))
s.connect(('localhost', PORT))
f1 = s.makefile('r')
f2 = s.makefile('w')
s.close()
Expand Down

0 comments on commit 212b51c

Please sign in to comment.