Skip to content

Commit

Permalink
Merge pull request #6121 from MetRonnie/fix-tests
Browse files Browse the repository at this point in the history
Fix tests
  • Loading branch information
hjoliver authored Jun 5, 2024
2 parents 450728a + da330fc commit 98dc86a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
5 changes: 3 additions & 2 deletions tests/integration/test_data_store_mgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,9 @@ async def test_delta_task_state(harness):
async def test_delta_task_held(harness):
"""Test update_data_structure. This method will generate and
apply adeltas/updates given."""
schd: Scheduler
schd, data = harness
schd.pool.hold_tasks('*')
schd.pool.hold_tasks(['*'])
await schd.update_data_structure()
assert True in {t.is_held for t in data[TASK_PROXIES].values()}
for itask in schd.pool.get_tasks():
Expand Down Expand Up @@ -270,7 +271,7 @@ async def test_update_data_structure(harness):
schd, data = harness
w_id = schd.data_store_mgr.workflow_id
schd.data_store_mgr.data[w_id] = data
schd.pool.hold_tasks('*')
schd.pool.hold_tasks(['*'])
await schd.update_data_structure()
assert TASK_STATUS_FAILED not in set(collect_states(data, TASK_PROXIES))
assert TASK_STATUS_FAILED not in set(collect_states(data, FAMILY_PROXIES))
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_graphql.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ async def harness(mod_flow, mod_scheduler, mod_run):
schd: 'Scheduler' = mod_scheduler(id_)
async with mod_run(schd):
client = WorkflowRuntimeClient(id_)
schd.pool.hold_tasks('*')
schd.pool.hold_tasks(['*'])
schd.resume_workflow()
# Think this is needed to save the data state at first start (?)
# Fails without it.. and a test needs to overwrite schd data with this.
Expand Down
8 changes: 5 additions & 3 deletions tests/integration/test_queues.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import pytest

from cylc.flow.scheduler import Scheduler


@pytest.fixture
def param_workflow(flow, scheduler):
Expand Down Expand Up @@ -86,7 +88,7 @@ async def test_queue_held_tasks(
https://github.com/cylc/cylc-flow/issues/4628
"""
schd = param_workflow(paused_start=True, queue_limit=1)
schd: Scheduler = param_workflow(paused_start=True, queue_limit=1)

async with start(schd):
# capture task submissions (prevents real submissions)
Expand All @@ -97,7 +99,7 @@ async def test_queue_held_tasks(

# hold all tasks and resume the workflow
# (nothing should have run yet because the workflow started paused)
schd.command_hold('*/*')
schd.command_hold(['*/*'])
schd.resume_workflow()

# release queued tasks
Expand All @@ -106,7 +108,7 @@ async def test_queue_held_tasks(
assert len(submitted_tasks) == 0

# un-hold tasks
schd.command_release('*/*')
schd.command_release(['*/*'])

# release queued tasks
# (tasks should now be released from the queues)
Expand Down
10 changes: 6 additions & 4 deletions tests/integration/test_task_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,17 +497,19 @@ async def test_hold_point(
(TASK_STATUS_SUCCEEDED, True),
]
)
async def test_trigger_states(status, should_trigger, one, start):
async def test_trigger_states(
status: str, should_trigger: bool, one: 'Scheduler', start: Callable
):
"""It should only trigger tasks in compatible states."""

async with start(one):
task = one.pool.filter_task_proxies('1/a')[0][0]
task = one.pool.filter_task_proxies(['1/one'])[0][0]

# reset task a to the provided state
task.state.reset(status)

# try triggering the task
one.pool.force_trigger_tasks('1/a', [FLOW_ALL])
one.pool.force_trigger_tasks(['1/one'], [FLOW_ALL])

# check whether the task triggered
assert task.is_manual_submit == should_trigger
Expand Down Expand Up @@ -1219,7 +1221,7 @@ async def test_detect_incomplete_tasks(
# the task should not have been removed
assert itask in schd.pool.get_tasks()


async def test_future_trigger_final_point(
flow,
scheduler,
Expand Down

0 comments on commit 98dc86a

Please sign in to comment.