diff --git a/tests/reference_base_device.py b/tests/long_running_tasks/reference_base_device.py similarity index 100% rename from tests/reference_base_device.py rename to tests/long_running_tasks/reference_base_device.py diff --git a/tests/test_reference_base_device.py b/tests/long_running_tasks/test_reference_base_device.py similarity index 99% rename from tests/test_reference_base_device.py rename to tests/long_running_tasks/test_reference_base_device.py index 27b56cfef4d3fc4bf8548f2127d9d4acf74bf482..b9da1ccc3016247e430e06bee6514fa4b119b8f3 100644 --- a/tests/test_reference_base_device.py +++ b/tests/long_running_tasks/test_reference_base_device.py @@ -9,7 +9,7 @@ from unittest import mock from tango import EventType from tango.test_context import DeviceTestContext from tango.utils import EventCallback -from .reference_base_device import ( +from reference_base_device import ( BlockingBaseDevice, AsyncBaseDevice, ) diff --git a/tests/test_task_queue_manager.py b/tests/long_running_tasks/test_task_queue_manager.py similarity index 98% rename from tests/test_task_queue_manager.py rename to tests/long_running_tasks/test_task_queue_manager.py index f3fa032b6ea63fb0ec0f20166e2feb096f29ac7b..1d4d8790fc7673398f245b6d52e58a707046fe5d 100644 --- a/tests/test_task_queue_manager.py +++ b/tests/long_running_tasks/test_task_queue_manager.py @@ -222,8 +222,9 @@ class TestQueueManagerTasks: 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 + # Give a buffer of 2 just in case a task finishes up quicker than expected assert results[-1] == ResultCode.OK - for res in results[:-1]: + for res in results[:-3]: assert res == ResultCode.REJECTED with patch.object(QueueManager, "result_callback") as my_cb: @@ -235,9 +236,10 @@ class TestQueueManagerTasks: time.sleep(0.5) 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. + # Give a buffer of 2 just in case a task finishes up quicker than expected assert results[-1] == ResultCode.OK assert results[-2] == ResultCode.OK - for res in results[:-2]: + for res in results[:-4]: assert res == ResultCode.REJECTED @pytest.mark.timeout(5) @@ -410,6 +412,7 @@ class TestQueueManagerExit: tr = TaskResult.from_task_result(qm.task_result) if tr.unique_id == unique_id and tr.result_code == ResultCode.ABORTED: break + time.sleep(0.1) # Resume the commands qm.resume_tasks()