[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 e37d4557c3)

Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
Miss Islington (bot) 2023-10-05 09:58:46 -07:00 committed by GitHub
parent 34c7793cd0
commit cacea7a272
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5239,6 +5239,7 @@ def test_create_connection_timeout(self):
class NetworkConnectionAttributesTest(SocketTCPTest, ThreadableTest):
cli = None
def __init__(self, methodName='runTest'):
SocketTCPTest.__init__(self, methodName=methodName)
@ -5248,7 +5249,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)