Skip to content

Commit c8a551e

Browse files
committed
Replaced functional test with integration test.
1 parent 43405da commit c8a551e

File tree

4 files changed

+34
-54
lines changed

4 files changed

+34
-54
lines changed

tests/functional/cylc-set/10-bad-pre.t

Lines changed: 0 additions & 28 deletions
This file was deleted.

tests/functional/cylc-set/10-bad-pre/flow.cylc

Lines changed: 0 additions & 23 deletions
This file was deleted.

tests/functional/cylc-set/10-bad-pre/reference.log

Lines changed: 0 additions & 3 deletions
This file was deleted.

tests/integration/scripts/test_set.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,17 @@
1919
Note: see also functional tests
2020
"""
2121

22+
import logging
23+
import pytest
24+
2225
from cylc.flow.cycling.integer import IntegerPoint
2326
from cylc.flow.data_messages_pb2 import PbTaskProxy
2427
from cylc.flow.data_store_mgr import TASK_PROXIES
2528
from cylc.flow.scheduler import Scheduler
2629
from cylc.flow.task_state import TASK_STATUS_SUCCEEDED, TASK_STATUS_WAITING
2730

31+
from typing import Callable
32+
2833

2934
async def test_set_parentless_spawning(
3035
flow,
@@ -164,3 +169,32 @@ async def test_pre_all(flow, scheduler, run):
164169
schd.pool.set_prereqs_and_outputs(['1/z'], [], ['all'], ['all'])
165170
warn_or_higher = [i for i in log.records if i.levelno > 30]
166171
assert warn_or_higher == []
172+
173+
174+
async def test_bad_prereq(
175+
flow: 'Callable',
176+
scheduler: 'Callable',
177+
run: 'Callable',
178+
complete: 'Callable',
179+
caplog: 'pytest.LogCaptureFixture'
180+
):
181+
"""Attempting to set an invalid prerequisite should not leave a trace in
182+
the DB that prevents the target task from spawning. later on.
183+
"""
184+
id_ = flow({
185+
'scheduling': {
186+
'graph': {'R1': 'a => b => c'},
187+
},
188+
})
189+
schd = scheduler(id_, paused_start=False)
190+
async with run(schd):
191+
schd.pool.set_prereqs_and_outputs(['1/c'], [], ['1/a'], [])
192+
assert schd.pool.get_task_ids() == {'1/a'}
193+
assert '1/c does not depend on "1/a:succeeded"' in caplog.text
194+
195+
schd.workflow_db_mgr.process_queued_ops()
196+
197+
# This will fail if the previous set left 1/c in the DB:
198+
schd.pool.set_prereqs_and_outputs(['1/c'], [], ['1/b'], [])
199+
assert schd.pool.get_task_ids() == {'1/a', '1/c'}
200+
await complete(schd, '1/c', timeout=5)

0 commit comments

Comments
 (0)