Skip to content

Commit

Permalink
un-skip test for tasks which shouldn't execute
Browse files Browse the repository at this point in the history
  • Loading branch information
stchris committed Jun 12, 2024
1 parent 87ffe7e commit 7192299
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions tests/test_taskqueue.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ def test_task_queue(self):
end_time = unpack_datetime(status["end_time"])
assert started < end_time < last_updated

@skip("Unfinished")
@patch("servicelayer.taskqueue.Dataset.should_execute")
def test_task_that_shouldnt_execute(self, mock_should_execute):
test_queue_name = "sls-queue-ingest"
Expand Down Expand Up @@ -147,6 +146,18 @@ def did_nack():

worker = CountingWorker(queues=[test_queue_name], conn=conn, num_threads=1)
assert not dataset.should_execute(task_id=task_id)
worker.process(blocking=False)
with patch.object(
worker,
attribute="dispatch_task",
return_value=None,
) as dispatch_fn:
with patch.object(
pika.channel.Channel,
attribute="basic_nack",
return_value=None,
) as nack_fn:
worker.process(blocking=False)
nack_fn.assert_any_call(delivery_tag=1, multiple=False, requeue=True)
dispatch_fn.assert_not_called()

channel.close()

0 comments on commit 7192299

Please sign in to comment.