diff options
author | Victor Stinner <vstinner@python.org> | 2023-10-05 16:31:02 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-05 16:31:02 (GMT) |
commit | e37d4557c3de0476e76ca4b8a1cc8d2566b86c79 (patch) | |
tree | ec26ceb85b169b87baa1de213107cc426adfa266 | |
parent | 6e97a9647ae028facb392d12fc24973503693bd6 (diff) | |
download | cpython-e37d4557c3de0476e76ca4b8a1cc8d2566b86c79.zip cpython-e37d4557c3de0476e76ca4b8a1cc8d2566b86c79.tar.gz cpython-e37d4557c3de0476e76ca4b8a1cc8d2566b86c79.tar.bz2 |
gh-110391: socket NetworkConnectionAttributesTest always declare cli (#110401)
NetworkConnectionAttributesTest of test_socket now always declare the
'cli' attribute, so clientTearDown() cannot fail with AttributeError.
-rw-r--r-- | Lib/test/test_socket.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index 99c4c5c..09605f7 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -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) |