mirror of
https://github.com/python/cpython.git
synced 2025-08-09 19:38:42 +00:00
[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 e37d4557c3
)
Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
09ec8153c6
commit
4a87f92724
1 changed files with 3 additions and 1 deletions
|
@ -5356,6 +5356,7 @@ class NetworkConnectionNoServer(unittest.TestCase):
|
|||
|
||||
|
||||
class NetworkConnectionAttributesTest(SocketTCPTest, ThreadableTest):
|
||||
cli = None
|
||||
|
||||
def __init__(self, methodName='runTest'):
|
||||
SocketTCPTest.__init__(self, methodName=methodName)
|
||||
|
@ -5365,7 +5366,8 @@ class NetworkConnectionAttributesTest(SocketTCPTest, ThreadableTest):
|
|||
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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue