From 86667a6e7f8ab56b928b7ead7177a7daef90e153 Mon Sep 17 00:00:00 2001 From: Jusong Yu Date: Wed, 27 Nov 2024 15:11:43 +0100 Subject: [PATCH] test_communicator.py / test_process_comms.py --- test/rmq/test_communicator.py | 8 +++----- test/rmq/test_process_comms.py | 10 +++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/test/rmq/test_communicator.py b/test/rmq/test_communicator.py index 1ef13a8e..a446aae7 100644 --- a/test/rmq/test_communicator.py +++ b/test/rmq/test_communicator.py @@ -61,7 +61,7 @@ class TestLoopCommunicator: @pytest.mark.asyncio async def test_broadcast(self, loop_communicator): - BROADCAST = {'body': 'present', 'sender': 'Martin', 'subject': 'sup', 'correlation_id': 420} + BROADCAST = {'body': 'present', 'sender': 'Martin', 'subject': 'sup', 'correlation_id': 420} # noqa: N806 broadcast_future = plumpy.Future() loop = asyncio.get_event_loop() @@ -83,8 +83,6 @@ def get_broadcast(_comm, body, sender, subject, correlation_id): async def test_broadcast_filter(self, loop_communicator): broadcast_future = plumpy.Future() - loop = asyncio.get_event_loop() - def ignore_broadcast(_comm, body, sender, subject, correlation_id): broadcast_future.set_exception(AssertionError('broadcast received')) @@ -102,7 +100,7 @@ def get_broadcast(_comm, body, sender, subject, correlation_id): @pytest.mark.asyncio async def test_rpc(self, loop_communicator): - MSG = 'rpc this' + MSG = 'rpc this' # noqa: N806 rpc_future = plumpy.Future() loop = asyncio.get_event_loop() @@ -119,7 +117,7 @@ def get_rpc(_comm, msg): @pytest.mark.asyncio async def test_task(self, loop_communicator): - TASK = 'task this' + TASK = 'task this' # noqa: N806 task_future = plumpy.Future() loop = asyncio.get_event_loop() diff --git a/test/rmq/test_process_comms.py b/test/rmq/test_process_comms.py index 97a949ab..5a8525bd 100644 --- a/test/rmq/test_process_comms.py +++ b/test/rmq/test_process_comms.py @@ -46,7 +46,7 @@ class TestRemoteProcessController: async def test_pause(self, thread_communicator, async_controller): proc = utils.WaitForSignalProcess(communicator=thread_communicator) # Run the process in the background - asyncio.ensure_future(proc.step_until_terminated()) + asyncio.ensure_future(proc.step_until_terminated()) # noqa: RUF006 # Send a pause message result = await async_controller.pause_process(proc.pid) @@ -58,7 +58,7 @@ async def test_pause(self, thread_communicator, async_controller): async def test_play(self, thread_communicator, async_controller): proc = utils.WaitForSignalProcess(communicator=thread_communicator) # Run the process in the background - asyncio.ensure_future(proc.step_until_terminated()) + asyncio.ensure_future(proc.step_until_terminated()) # noqa: RUF006 assert proc.pause() # Send a play message @@ -76,7 +76,7 @@ async def test_play(self, thread_communicator, async_controller): async def test_kill(self, thread_communicator, async_controller): proc = utils.WaitForSignalProcess(communicator=thread_communicator) # Run the process in the event loop - asyncio.ensure_future(proc.step_until_terminated()) + asyncio.ensure_future(proc.step_until_terminated()) # noqa: RUF006 # Send a kill message and wait for it to be done result = await async_controller.kill_process(proc.pid) @@ -89,7 +89,7 @@ async def test_kill(self, thread_communicator, async_controller): async def test_status(self, thread_communicator, async_controller): proc = utils.WaitForSignalProcess(communicator=thread_communicator) # Run the process in the background - asyncio.ensure_future(proc.step_until_terminated()) + asyncio.ensure_future(proc.step_until_terminated()) # noqa: RUF006 # Send a status message status = await async_controller.get_status(proc.pid) @@ -202,7 +202,7 @@ async def test_kill_all(self, thread_communicator, sync_controller): async def test_status(self, thread_communicator, sync_controller): proc = utils.WaitForSignalProcess(communicator=thread_communicator) # Run the process in the background - asyncio.ensure_future(proc.step_until_terminated()) + asyncio.ensure_future(proc.step_until_terminated()) # noqa: RUF006 # Send a status message status_future = sync_controller.get_status(proc.pid)