55
66import pytest
77
8- from pyoverkiz .action_queue import ActionQueue , QueuedExecution
8+ from pyoverkiz .action_queue import ActionQueue , ActionQueueSettings , QueuedExecution
99from pyoverkiz .enums import ExecutionMode , OverkizCommand
1010from pyoverkiz .models import Action , Command
1111
@@ -24,7 +24,7 @@ async def executor(actions, mode, label):
2424@pytest .mark .asyncio
2525async def test_action_queue_single_action (mock_executor ):
2626 """Test queue with a single action."""
27- queue = ActionQueue (executor = mock_executor , delay = 0.1 )
27+ queue = ActionQueue (executor = mock_executor , settings = ActionQueueSettings ( delay = 0.1 ) )
2828
2929 action = Action (
3030 device_url = "io://1234-5678-9012/1" ,
@@ -45,7 +45,7 @@ async def test_action_queue_single_action(mock_executor):
4545@pytest .mark .asyncio
4646async def test_action_queue_batching (mock_executor ):
4747 """Test that multiple actions are batched together."""
48- queue = ActionQueue (executor = mock_executor , delay = 0.2 )
48+ queue = ActionQueue (executor = mock_executor , settings = ActionQueueSettings ( delay = 0.2 ) )
4949
5050 actions = [
5151 Action (
@@ -75,7 +75,9 @@ async def test_action_queue_batching(mock_executor):
7575@pytest .mark .asyncio
7676async def test_action_queue_max_actions_flush (mock_executor ):
7777 """Test that queue flushes when max actions is reached."""
78- queue = ActionQueue (executor = mock_executor , delay = 10.0 , max_actions = 3 )
78+ queue = ActionQueue (
79+ executor = mock_executor , settings = ActionQueueSettings (delay = 10.0 , max_actions = 3 )
80+ )
7981
8082 actions = [
8183 Action (
@@ -112,8 +114,8 @@ async def test_action_queue_max_actions_flush(mock_executor):
112114
113115@pytest .mark .asyncio
114116async def test_action_queue_mode_change_flush (mock_executor ):
115- """Test that queue flushes when execution mode changes."""
116- queue = ActionQueue (executor = mock_executor , delay = 0.5 )
117+ """Test that queue flushes when command mode changes."""
118+ queue = ActionQueue (executor = mock_executor , settings = ActionQueueSettings ( delay = 0.5 ) )
117119
118120 action = Action (
119121 device_url = "io://1234-5678-9012/1" ,
@@ -140,7 +142,7 @@ async def test_action_queue_mode_change_flush(mock_executor):
140142@pytest .mark .asyncio
141143async def test_action_queue_label_change_flush (mock_executor ):
142144 """Test that queue flushes when label changes."""
143- queue = ActionQueue (executor = mock_executor , delay = 0.5 )
145+ queue = ActionQueue (executor = mock_executor , settings = ActionQueueSettings ( delay = 0.5 ) )
144146
145147 action = Action (
146148 device_url = "io://1234-5678-9012/1" ,
@@ -167,7 +169,7 @@ async def test_action_queue_label_change_flush(mock_executor):
167169@pytest .mark .asyncio
168170async def test_action_queue_duplicate_device_merge (mock_executor ):
169171 """Test that queue merges commands for duplicate devices."""
170- queue = ActionQueue (executor = mock_executor , delay = 0.5 )
172+ queue = ActionQueue (executor = mock_executor , settings = ActionQueueSettings ( delay = 0.5 ) )
171173
172174 action1 = Action (
173175 device_url = "io://1234-5678-9012/1" ,
@@ -191,7 +193,7 @@ async def test_action_queue_duplicate_device_merge(mock_executor):
191193@pytest .mark .asyncio
192194async def test_action_queue_duplicate_device_merge_order (mock_executor ):
193195 """Test that command order is preserved when merging."""
194- queue = ActionQueue (executor = mock_executor , delay = 0.1 )
196+ queue = ActionQueue (executor = mock_executor , settings = ActionQueueSettings ( delay = 0.1 ) )
195197
196198 action1 = Action (
197199 device_url = "io://1234-5678-9012/1" ,
@@ -219,7 +221,7 @@ async def test_action_queue_duplicate_device_merge_does_not_mutate_inputs(
219221 mock_executor ,
220222):
221223 """Test that merge behavior does not mutate caller-owned Action commands."""
222- queue = ActionQueue (executor = mock_executor , delay = 0.1 )
224+ queue = ActionQueue (executor = mock_executor , settings = ActionQueueSettings ( delay = 0.1 ) )
223225
224226 action1 = Action (
225227 device_url = "io://1234-5678-9012/1" ,
@@ -240,7 +242,9 @@ async def test_action_queue_duplicate_device_merge_does_not_mutate_inputs(
240242@pytest .mark .asyncio
241243async def test_action_queue_manual_flush (mock_executor ):
242244 """Test manual flush of the queue."""
243- queue = ActionQueue (executor = mock_executor , delay = 10.0 ) # Long delay
245+ queue = ActionQueue (
246+ executor = mock_executor , settings = ActionQueueSettings (delay = 10.0 )
247+ ) # Long delay
244248
245249 action = Action (
246250 device_url = "io://1234-5678-9012/1" ,
@@ -261,7 +265,9 @@ async def test_action_queue_manual_flush(mock_executor):
261265@pytest .mark .asyncio
262266async def test_action_queue_shutdown (mock_executor ):
263267 """Test that shutdown flushes pending actions."""
264- queue = ActionQueue (executor = mock_executor , delay = 10.0 )
268+ queue = ActionQueue (
269+ executor = mock_executor , settings = ActionQueueSettings (delay = 10.0 )
270+ )
265271
266272 action = Action (
267273 device_url = "io://1234-5678-9012/1" ,
@@ -284,7 +290,7 @@ async def test_action_queue_error_propagation(mock_executor):
284290 # Make executor raise an exception
285291 mock_executor .side_effect = ValueError ("API Error" )
286292
287- queue = ActionQueue (executor = mock_executor , delay = 0.1 )
293+ queue = ActionQueue (executor = mock_executor , settings = ActionQueueSettings ( delay = 0.1 ) )
288294
289295 action = Action (
290296 device_url = "io://1234-5678-9012/1" ,
@@ -306,7 +312,7 @@ async def test_action_queue_error_propagation(mock_executor):
306312async def test_action_queue_get_pending_count ():
307313 """Test getting pending action count."""
308314 mock_executor = AsyncMock (return_value = "exec-123" )
309- queue = ActionQueue (executor = mock_executor , delay = 0.5 )
315+ queue = ActionQueue (executor = mock_executor , settings = ActionQueueSettings ( delay = 0.5 ) )
310316
311317 assert queue .get_pending_count () == 0
312318
0 commit comments