Skip to content
Snippets Groups Projects
Unverified Commit 114716d9 authored by SKAJohanVenter's avatar SKAJohanVenter
Browse files

SAR-276 Cleaned up tests

parent fcb8e38b
Branches
No related tags found
No related merge requests found
...@@ -9,7 +9,7 @@ from unittest import mock ...@@ -9,7 +9,7 @@ from unittest import mock
from tango import EventType from tango import EventType
from tango.test_context import DeviceTestContext from tango.test_context import DeviceTestContext
from tango.utils import EventCallback from tango.utils import EventCallback
from .reference_base_device import ( from reference_base_device import (
BlockingBaseDevice, BlockingBaseDevice,
AsyncBaseDevice, AsyncBaseDevice,
) )
......
...@@ -222,8 +222,9 @@ class TestQueueManagerTasks: ...@@ -222,8 +222,9 @@ class TestQueueManagerTasks:
results = [i[0][0].result_code for i in my_cb.call_args_list] results = [i[0][0].result_code for i in my_cb.call_args_list]
# 9/10 should be rejected since the first is busy and the queue length is 1 # 9/10 should be rejected since the first is busy and the queue length is 1
# Give a buffer of 2 just in case a task finishes up quicker than expected
assert results[-1] == ResultCode.OK assert results[-1] == ResultCode.OK
for res in results[:-1]: for res in results[:-3]:
assert res == ResultCode.REJECTED assert res == ResultCode.REJECTED
with patch.object(QueueManager, "result_callback") as my_cb: with patch.object(QueueManager, "result_callback") as my_cb:
...@@ -235,9 +236,10 @@ class TestQueueManagerTasks: ...@@ -235,9 +236,10 @@ class TestQueueManagerTasks:
time.sleep(0.5) time.sleep(0.5)
results = [i[0][0].result_code for i in my_cb.call_args_list] results = [i[0][0].result_code for i in my_cb.call_args_list]
# 8/10 should be rejected since two are taken to be processed. # 8/10 should be rejected since two are taken to be processed.
# Give a buffer of 2 just in case a task finishes up quicker than expected
assert results[-1] == ResultCode.OK assert results[-1] == ResultCode.OK
assert results[-2] == ResultCode.OK assert results[-2] == ResultCode.OK
for res in results[:-2]: for res in results[:-4]:
assert res == ResultCode.REJECTED assert res == ResultCode.REJECTED
@pytest.mark.timeout(5) @pytest.mark.timeout(5)
...@@ -410,6 +412,7 @@ class TestQueueManagerExit: ...@@ -410,6 +412,7 @@ class TestQueueManagerExit:
tr = TaskResult.from_task_result(qm.task_result) tr = TaskResult.from_task_result(qm.task_result)
if tr.unique_id == unique_id and tr.result_code == ResultCode.ABORTED: if tr.unique_id == unique_id and tr.result_code == ResultCode.ABORTED:
break break
time.sleep(0.1)
# Resume the commands # Resume the commands
qm.resume_tasks() qm.resume_tasks()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment