From: Ben Darnell Date: Thu, 11 Jul 2024 18:09:12 +0000 (-0400) Subject: test: Remove an obsolete mixin pattern in concurrent_test X-Git-Tag: v6.5.0b1~41^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=57c9dac0c812db0a69502d5ef922e5ae0d56598b;p=thirdparty%2Ftornado.git test: Remove an obsolete mixin pattern in concurrent_test All but one implementation of this mixin has been removed, so we no longer need the abstraction. --- diff --git a/tornado/test/concurrent_test.py b/tornado/test/concurrent_test.py index ea20ed36..90fbcb12 100644 --- a/tornado/test/concurrent_test.py +++ b/tornado/test/concurrent_test.py @@ -16,7 +16,6 @@ from concurrent import futures import logging import re import socket -import typing import unittest from tornado.concurrent import ( @@ -124,33 +123,31 @@ class GeneratorCapClient(BaseCapClient): raise gen.Return(self.process_response(data)) -class ClientTestMixin: - client_class = None # type: typing.Callable - +class GeneratorCapClientTest(AsyncTestCase): def setUp(self): - super().setUp() # type: ignore + super().setUp() self.server = CapServer() sock, port = bind_unused_port() self.server.add_sockets([sock]) - self.client = self.client_class(port=port) + self.client = GeneratorCapClient(port=port) def tearDown(self): self.server.stop() - super().tearDown() # type: ignore + super().tearDown() - def test_future(self: typing.Any): + def test_future(self): future = self.client.capitalize("hello") self.io_loop.add_future(future, self.stop) self.wait() self.assertEqual(future.result(), "HELLO") - def test_future_error(self: typing.Any): + def test_future_error(self): future = self.client.capitalize("HELLO") self.io_loop.add_future(future, self.stop) self.wait() - self.assertRaisesRegex(CapError, "already capitalized", future.result) # type: ignore + self.assertRaisesRegex(CapError, "already capitalized", future.result) - def test_generator(self: typing.Any): + def test_generator(self): @gen.coroutine def f(): result = yield self.client.capitalize("hello") @@ -158,7 +155,7 @@ class ClientTestMixin: self.io_loop.run_sync(f) - def test_generator_error(self: typing.Any): + def test_generator_error(self): @gen.coroutine def f(): with self.assertRaisesRegex(CapError, "already capitalized"): @@ -167,10 +164,6 @@ class ClientTestMixin: self.io_loop.run_sync(f) -class GeneratorClientTest(ClientTestMixin, AsyncTestCase): - client_class = GeneratorCapClient - - class RunOnExecutorTest(AsyncTestCase): @gen_test def test_no_calling(self):