Skip to content

Commit

Permalink
Fixed mostly tests with non existent async def setUp
Browse files Browse the repository at this point in the history
  • Loading branch information
timotta committed Feb 17, 2023
1 parent 4a64752 commit 6c74c99
Show file tree
Hide file tree
Showing 19 changed files with 22 additions and 25 deletions.
4 changes: 2 additions & 2 deletions itests/easyqueue/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@


class ConnectionTest(IsolatedAsyncioTestCase):
async def setUp(self):
def setUp(self):
self.conn = AMQPConnection("127.0.0.1", "guest", "guest")

async def tearDown(self):
async def asyncTearDown(self):
await self.conn.close()

async def test_can_call_close_multiple_times(self):
Expand Down
2 changes: 1 addition & 1 deletion itests/easyqueue/test_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


class EnsureConnectedTest(IsolatedAsyncioTestCase):
async def setUp(self):
def setUp(self):
self.queue = JsonQueue(
host="127.0.0.1", username="guest", password="guest"
)
Expand Down
2 changes: 1 addition & 1 deletion itests/test_json_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ async def on_queue_message(self, msg: AMQPMessage[Any]):


class JsonQueueTest(IsolatedAsyncioTestCase):
async def setUp(self):
def setUp(self):
self.queue = JsonQueue(
"127.0.0.1", "guest", "guest", delegate=DumbConsumer()
)
Expand Down
4 changes: 2 additions & 2 deletions itests/test_rabbitmq_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


class RabbitMQConsumerTest(IsolatedAsyncioTestCase):
async def setUp(self):
def setUp(self):
self.queue_name = "test"
self.connection = AMQPConnection(
hostname="127.0.0.1", username="guest", password="guest", prefetch=1
Expand Down Expand Up @@ -125,7 +125,7 @@ async def callback(*args, **kwargs):
class AMQPConsumerTestWithAdditionalParameters(IsolatedAsyncioTestCase):
maxDiff = None

async def setUp(self):
async def asyncSetUp(self):
from aiohttp import ClientSession, BasicAuth

client = ClientSession()
Expand Down
4 changes: 2 additions & 2 deletions tests/easyqueue/test_async_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ class AsyncQueueConsumerHandlerMethodsTests(
def get_consumer(self):
return Mock(spec=QueueConsumerDelegate)

async def setUp(self):
async def asyncSetUp(self):
super().setUp()
self.properties = Mock(name="Properties")
self.delegate = Mock(spec=QueueConsumerDelegate)
Expand Down Expand Up @@ -525,7 +525,7 @@ async def test_it_calls_on_message_handle_error_if_message_handler_raises_an_err


class EnsureConnectedDecoratorTests(IsolatedAsyncioTestCase):
async def setUp(self):
def setUp(self):
self.seconds = 666
self.queue = JsonQueue(
"127.0.0.1",
Expand Down
2 changes: 1 addition & 1 deletion tests/http/test_http_decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


class HTTPDecoratorsTest(IsolatedAsyncioTestCase):
async def setUp(self):
def setUp(self):
self.app = App()

@self.app.http.post(["/get_by_id/{_id}"])
Expand Down
2 changes: 1 addition & 1 deletion tests/http/test_metrics_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class MetricsEndpointTest(IsolatedAsyncioTestCase):
use_default_loop = True
maxDiff = None

async def setUp(self):
def setUp(self):
self.METRICS_PATH = "/metrics-2"
self.app = App()
self.app.http.get([self.METRICS_PATH])(metrics_route_handler)
Expand Down
2 changes: 1 addition & 1 deletion tests/http/test_pathparam_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
class TestPathParamTypeHint(IsolatedAsyncioTestCase):
maxDiff = None

async def setUp(self):
def setUp(self):
self.app = App()

async def test_parse_simple_int(self):
Expand Down
2 changes: 1 addition & 1 deletion tests/metrics/test_http_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
class HTTPMetricsTests(IsolatedAsyncioTestCase):
app_url = f"http://{settings.HTTP_HOST}:{settings.HTTP_PORT}"

async def setUp(self):
async def asyncSetUp(self):
self.app = App()
self.client = ClientSession()

Expand Down
2 changes: 1 addition & 1 deletion tests/signals/handlers/test_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@


class HTTPServerTests(IsolatedAsyncioTestCase):
async def setUp(self):
def setUp(self):
self.signal_handler = HTTPServer()

handler1 = Mock(return_value=AsyncMock())
Expand Down
2 changes: 1 addition & 1 deletion tests/signals/handlers/test_rabbitmq.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


class AMQPTests(IsolatedAsyncioTestCase):
async def setUp(self):
def setUp(self):
self.signal_handler = RabbitMQ()

handler1 = Mock(return_value=AsyncMock())
Expand Down
2 changes: 1 addition & 1 deletion tests/signals/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


class SignalTests(IsolatedAsyncioTestCase):
async def setUp(self):
def setUp(self):
self.owner = Mock(freeze=AsyncMock())
self.signal = Signal(self.owner)

Expand Down
2 changes: 1 addition & 1 deletion tests/task_runners/test_scheduled.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


class ScheduledTaskRunnerTests(IsolatedAsyncioTestCase):
async def setUp(self):
def setUp(self):
reload(task_runners)
self.task = AsyncMock()
self.app = Mock(spec=App)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@


class AppTests(IsolatedAsyncioTestCase):
async def setUp(self):
def setUp(self):
class MyApp(App):
handlers = (
Mock(startup=AsyncMock(), shutdown=AsyncMock()),
Expand Down
2 changes: 1 addition & 1 deletion tests/test_connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


class ConnectionsMappingTest(IsolatedAsyncioTestCase):
async def setUp(self):
def setUp(self):
self.connection = AMQPConnection(
hostname="localhost", username="guest", password="pwd"
)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async def _wrapper(other: str, flag: bool):


class TestWrapsDecorator(IsolatedAsyncioTestCase):
async def setUp(self):
def setUp(self):
self.registry = TypesRegistry()
self.resolver = ArgResolver(registry=self.registry)

Expand Down
4 changes: 2 additions & 2 deletions tests/test_test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async def _h():


class HttpClientTestCaseDecoratorTest(IsolatedAsyncioTestCase):
async def setUp(self):
def setUp(self):
self.app = App()

async def test_client_is_passed_to_test(self):
Expand Down Expand Up @@ -81,7 +81,7 @@ async def other_method(http_client):


class HttpClientContextManagerTest(IsolatedAsyncioTestCase):
async def setUp(self):
def setUp(self):
self.app = App()

async def test_client_can_perform_requests(self):
Expand Down
2 changes: 1 addition & 1 deletion tests/types/test_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


class TypesRegistryTest(IsolatedAsyncioTestCase):
async def setUp(self):
def setUp(self):
self.registry = TypesRegistry()

async def test_simple_set_get_object(self):
Expand Down
3 changes: 0 additions & 3 deletions tests/typing/test_typing_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ class MyObject:


class TestTypingFunctions(IsolatedAsyncioTestCase):
async def setUp(self):
pass

async def test_get_args_generic_type(self):
self.assertEqual((MyObject,), get_args(MyGeneric[MyObject]))
self.assertEqual(
Expand Down

0 comments on commit 6c74c99

Please sign in to comment.