Skip to content

Commit 4a87f92

Browse files
[3.12] gh-110391: socket NetworkConnectionAttributesTest always declare cli (GH-110401) (#110405)
gh-110391: socket NetworkConnectionAttributesTest always declare cli (GH-110401) NetworkConnectionAttributesTest of test_socket now always declare the 'cli' attribute, so clientTearDown() cannot fail with AttributeError. (cherry picked from commit e37d455) Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent 09ec815 commit 4a87f92

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Lib/test/test_socket.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5356,6 +5356,7 @@ def test_create_connection_timeout(self):
53565356

53575357

53585358
class NetworkConnectionAttributesTest(SocketTCPTest, ThreadableTest):
5359+
cli = None
53595360

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

53675368
def clientTearDown(self):
5368-
self.cli.close()
5369+
if self.cli is not None:
5370+
self.cli.close()
53695371
self.cli = None
53705372
ThreadableTest.clientTearDown(self)
53715373

0 commit comments

Comments
 (0)