Skip to content

Commit

Permalink
pythongh-110391: socket NetworkConnectionAttributesTest always declar…
Browse files Browse the repository at this point in the history
…e cli (python#110401)

NetworkConnectionAttributesTest of test_socket now always declare the
'cli' attribute, so clientTearDown() cannot fail with AttributeError.
  • Loading branch information
vstinner authored and Glyphack committed Jan 27, 2024
1 parent 1a9dd16 commit b7ee44e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Lib/test/test_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -5356,6 +5356,7 @@ def test_create_connection_timeout(self):


class NetworkConnectionAttributesTest(SocketTCPTest, ThreadableTest):
cli = None

def __init__(self, methodName='runTest'):
SocketTCPTest.__init__(self, methodName=methodName)
Expand All @@ -5365,7 +5366,8 @@ def clientSetUp(self):
self.source_port = socket_helper.find_unused_port()

def clientTearDown(self):
self.cli.close()
if self.cli is not None:
self.cli.close()
self.cli = None
ThreadableTest.clientTearDown(self)

Expand Down

0 comments on commit b7ee44e

Please sign in to comment.