Skip to content

Commit

Permalink
test_communicator.py / test_process_comms.py
Browse files Browse the repository at this point in the history
  • Loading branch information
unkcpz committed Nov 27, 2024
1 parent e610aba commit 86667a6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
8 changes: 3 additions & 5 deletions test/rmq/test_communicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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'))

Expand All @@ -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()
Expand All @@ -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()
Expand Down
10 changes: 5 additions & 5 deletions test/rmq/test_process_comms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 86667a6

Please sign in to comment.