Skip to content

Commit cacea7a

Browse files
[3.11] gh-110391: socket NetworkConnectionAttributesTest always declare cli (GH-110401) (#110406)
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 <[email protected]>
1 parent 34c7793 commit cacea7a

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
@@ -5239,6 +5239,7 @@ def test_create_connection_timeout(self):
52395239

52405240

52415241
class NetworkConnectionAttributesTest(SocketTCPTest, ThreadableTest):
5242+
cli = None
52425243

52435244
def __init__(self, methodName='runTest'):
52445245
SocketTCPTest.__init__(self, methodName=methodName)
@@ -5248,7 +5249,8 @@ def clientSetUp(self):
52485249
self.source_port = socket_helper.find_unused_port()
52495250

52505251
def clientTearDown(self):
5251-
self.cli.close()
5252+
if self.cli is not None:
5253+
self.cli.close()
52525254
self.cli = None
52535255
ThreadableTest.clientTearDown(self)
52545256

0 commit comments

Comments
 (0)