Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,11 @@ def _submit_task_jobs(*args, **kwargs):
deps = tuple(sorted(itask.state.get_resolved_dependencies()))
if flow_nums:
triggers.add(
(itask.identity, serialise_set(itask.flow_nums), deps or None)
(
itask.identity,
serialise_set(itask.flow_nums),
deps or None,
)
)
else:
triggers.add((itask.identity, deps or None))
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/events/test_task_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ async def test_event_email_body(
ctx = SimpleNamespace(mail_to=None, mail_from=None)
async with start(mod_one):
# send a custom task message with the warning severity level
id_keys = [EventKey('none', 'warning', 'warning message', Tokens('//1/a/01'))]
id_keys = [
EventKey('none', 'warning', 'warning message', Tokens('//1/a/01'))
]
mod_one.task_events_mgr._process_event_email(mod_one, ctx, id_keys)

# test the email which would have been sent for this message
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/network/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ async def test_command_validation_failure(harness):
pytest.param({'error': 'message'}, r"^message$", id="basic"),
pytest.param(
{'foo': 1},
r"^Received invalid response for Cylc 8\.[\w.]+: \{'foo': 1[^}]*\}$",
r"^Received invalid response for"
r" Cylc 8\.[\w.]+: \{'foo': 1[^}]*\}$",
id="no-err-field",
),
pytest.param(
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/network/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ def _api(*args, **kwargs):
[
pytest.param(
{'user': 'bono', 'args': {}},
f"Request missing field 'command' required for Cylc {CYLC_VERSION}",
"Request missing field 'command' required for"
f" Cylc {CYLC_VERSION}",
id='missing-command',
),
pytest.param(
Expand Down
10 changes: 9 additions & 1 deletion tests/integration/reftests/test_cyclers.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,15 @@ async def test_icp_fcp_notation(flow, scheduler, reftest):
('20160101T0000Z/bar', None),
('20160101T0100Z/baz', None),
('20160101T2300Z/boo', None),
('20160102T0000Z/bot', ('20160101T0000Z/bar', '20160101T0000Z/foo', '20160101T0100Z/baz', '20160101T2300Z/boo')),
(
'20160102T0000Z/bot',
(
'20160101T0000Z/bar',
'20160101T0000Z/foo',
'20160101T0100Z/baz',
'20160101T2300Z/boo',
),
),
}


Expand Down
55 changes: 44 additions & 11 deletions tests/integration/reftests/test_pre_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,49 @@ async def test_advanced(flow, scheduler, reftest):
assert await reftest(schd) == {
('20100101T0000Z/b', None),
('20100101T0600Z/b', None),
('20100101T0000Z/a', ('20091231T1800Z/a', '20091231T1800Z/c', '20100101T0000Z/b')),
('20100101T0000Z/c', ('20091231T1800Z/a', '20091231T1800Z/c', '20100101T0000Z/b')),
(
'20100101T0000Z/a',
('20091231T1800Z/a', '20091231T1800Z/c', '20100101T0000Z/b'),
),
(
'20100101T0000Z/c',
('20091231T1800Z/a', '20091231T1800Z/c', '20100101T0000Z/b'),
),
('20100101T1200Z/b', None),
('20100101T0600Z/a', ('20100101T0000Z/a', '20100101T0000Z/c', '20100101T0600Z/b')),
('20100101T0600Z/c', ('20100101T0000Z/a', '20100101T0000Z/c', '20100101T0600Z/b')),
(
'20100101T0600Z/a',
('20100101T0000Z/a', '20100101T0000Z/c', '20100101T0600Z/b'),
),
(
'20100101T0600Z/c',
('20100101T0000Z/a', '20100101T0000Z/c', '20100101T0600Z/b'),
),
('20100101T1800Z/b', None),
('20100101T1200Z/a', ('20100101T0600Z/a', '20100101T0600Z/c', '20100101T1200Z/b')),
('20100101T1200Z/c', ('20100101T0600Z/a', '20100101T0600Z/c', '20100101T1200Z/b')),
(
'20100101T1200Z/a',
('20100101T0600Z/a', '20100101T0600Z/c', '20100101T1200Z/b'),
),
(
'20100101T1200Z/c',
('20100101T0600Z/a', '20100101T0600Z/c', '20100101T1200Z/b'),
),
('20100102T0000Z/b', None),
('20100101T1800Z/c', ('20100101T1200Z/a', '20100101T1200Z/c', '20100101T1800Z/b')),
('20100101T1800Z/a', ('20100101T1200Z/a', '20100101T1200Z/c', '20100101T1800Z/b')),
('20100102T0000Z/a', ('20100101T1800Z/a', '20100101T1800Z/c', '20100102T0000Z/b')),
('20100102T0000Z/c', ('20100101T1800Z/a', '20100101T1800Z/c', '20100102T0000Z/b')),
(
'20100101T1800Z/c',
('20100101T1200Z/a', '20100101T1200Z/c', '20100101T1800Z/b'),
),
(
'20100101T1800Z/a',
('20100101T1200Z/a', '20100101T1200Z/c', '20100101T1800Z/b'),
),
(
'20100102T0000Z/a',
('20100101T1800Z/a', '20100101T1800Z/c', '20100102T0000Z/b'),
),
(
'20100102T0000Z/c',
('20100101T1800Z/a', '20100101T1800Z/c', '20100102T0000Z/b'),
),
}


Expand Down Expand Up @@ -112,7 +142,10 @@ async def test_over_bracketed(flow, scheduler, reftest):

assert await reftest(schd) == {
('20131225T1200Z/c', None),
('20131225T1200Z/d', ('20131224T1200Z/a', '20131224T1200Z/b', '20131224T1200Z/c')),
(
'20131225T1200Z/d',
('20131224T1200Z/a', '20131224T1200Z/b', '20131224T1200Z/c'),
),
('20131225T1200Z/a', None),
('20131225T1200Z/b', None),
}
2 changes: 1 addition & 1 deletion tests/integration/run_modes/test_nonlive.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def _inner(schd):

# Check that timestamps have been created:
for timestamp in [
'time_submit', 'time_submit_exit', 'time_run', 'time_run_exit'
'time_submit', 'time_submit_exit', 'time_run', 'time_run_exit'
]:
assert task_jobs[timestamp] is not None
return _inner
Expand Down
22 changes: 15 additions & 7 deletions tests/integration/run_modes/test_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,20 @@ async def test_started_trigger(flow, reftest, scheduler):
Long standing Bug discovered in Skip Mode work.
https://github.com/cylc/cylc-flow/pull/6039#issuecomment-2321147445
"""
schd = scheduler(flow({
'scheduler': {'events': {'stall timeout': 'PT0S', 'abort on stall timeout': True}},
'scheduling': {'graph': {'R1': 'a:started => b'}}
}), paused_start=False)
schd = scheduler(
flow(
{
'scheduler': {
'events': {
'stall timeout': 'PT0S',
'abort on stall timeout': True,
}
},
'scheduling': {'graph': {'R1': 'a:started => b'}},
}
),
paused_start=False,
)
assert await reftest(schd) == {
('1/a', None),
('1/b', ('1/a',))
Expand Down Expand Up @@ -286,7 +296,7 @@ async def test_settings_restart(monkeytime, flow, scheduler, start):

# Stop and restart the scheduler:
schd = scheduler(id_)
async with start(schd) as log:
async with start(schd):
for itask in schd.pool.get_tasks():
# Check that we haven't got mode settings back:
assert itask.mode_settings is None
Expand All @@ -301,10 +311,8 @@ async def test_settings_restart(monkeytime, flow, scheduler, start):
)
schd.workflow_db_mgr.process_queued_ops()
monkeytime(42)
expected_timeout = 102.0
else:
monkeytime(og_timeouts[itask.identity] - 1)
expected_timeout = float(int(og_timeouts[itask.identity]))

assert sim_time_check(
schd.task_events_mgr, [itask], schd.workflow_db_mgr
Expand Down
7 changes: 4 additions & 3 deletions tests/integration/run_modes/test_skip.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,11 @@ async def test_prereqs_marked_satisfied_by_skip_mode(
assert satisfied_message == 'satisfied by skip mode'


async def test_outputs_can_be_changed(one_conf, flow, start, scheduler, validate):

async def test_outputs_can_be_changed(
one_conf, flow, start, scheduler, validate
):
schd = scheduler(flow(one_conf), run_mode='live')
async with start(schd) as log:
async with start(schd):
# Broadcast the task into skip mode, output failed and submit it:
schd.broadcast_mgr.put_broadcast(
["1"],
Expand Down
1 change: 0 additions & 1 deletion tests/integration/scripts/test_cat_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import pytest
import re
import shutil
from types import SimpleNamespace

from cylc.flow.exceptions import InputError
from cylc.flow.option_parsers import Options
Expand Down
7 changes: 4 additions & 3 deletions tests/integration/scripts/test_dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,23 +56,24 @@ async def test_dump_tasks(flow, scheduler, start):
)
assert ret == ['a, 1, waiting, not-held, queued, not-runahead']


@pytest.mark.parametrize(
'attributes_bool, flow_nums, dump_str',
[
pytest.param(
True,
[1,2],
[1, 2],
'1/a:waiting (held,queued,runahead) flows=[1,2]',
id='1'
),
pytest.param(
False,
[1,2],
[1, 2],
'1/a:waiting',
id='2'
)
]
)
)
async def test_dump_format(
flow, scheduler, start, attributes_bool, flow_nums, dump_str
):
Expand Down
1 change: 0 additions & 1 deletion tests/integration/scripts/test_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ async def test_mro(cylc_list, supports_utf8, capsys):
await cylc_list(capsys, titles=True, mro=True)



async def test_tree(cylc_list, supports_utf8, capsys):
"""Test the --tree option."""
assert (
Expand Down
40 changes: 22 additions & 18 deletions tests/integration/scripts/test_show.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,12 @@ async def test_task_instance_query(
schd = scheduler(
flow(
{
'scheduling': {
'graph': {'R1': 'zed & dog & cat & ant'},
},
}
'scheduling': {
'graph': {'R1': 'zed & dog & cat & ant'},
},
}
),
paused_start=False
paused_start=False
)
async with start(schd):
await schd.update_data_structure()
Expand All @@ -185,8 +185,8 @@ async def test_task_instance_query(

out, _ = capsys.readouterr()
assert [
line for line in out.splitlines()
if line.startswith("Task ID")
line for line in out.splitlines()
if line.startswith("Task ID")
] == [ # results should be sorted
'Task ID: 1/ant',
'Task ID: 1/cat',
Expand All @@ -202,13 +202,16 @@ async def test_task_instance_query(
False, [1], 'state: waiting', None,
),
pytest.param(
True, [1, 2], 'state: waiting (held,queued,runahead)', 'flows: [1,2]',
True,
[1, 2],
'state: waiting (held,queued,runahead)',
'flows: [1,2]',
)
]
)
async def test_task_instance_state_flows(
flow, scheduler, start, capsys,
attributes_bool, flow_nums, expected_state, expected_flows
attributes_bool, flow_nums, expected_state, expected_flows
):
"""It should print task instance state, attributes, and flows."""

Expand All @@ -222,12 +225,12 @@ async def test_task_instance_state_flows(
schd = scheduler(
flow(
{
'scheduling': {
'graph': {'R1': 'a'},
},
}
'scheduling': {
'graph': {'R1': 'a'},
},
}
),
paused_start=True
paused_start=True
)
async with start(schd):

Expand All @@ -254,15 +257,16 @@ async def test_task_instance_state_flows(

out, _ = capsys.readouterr()
assert [
line for line in out.splitlines()
if line.startswith("state:")
line for line in out.splitlines()
if line.startswith("state:")
] == [
expected_state,
]

if expected_flows is not None:
assert [
line for line in out.splitlines()
if line.startswith("flows:")
line for line in out.splitlines()
if line.startswith("flows:")
] == [
expected_flows,
]
8 changes: 6 additions & 2 deletions tests/integration/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,9 @@ def _inner(*args, **kwargs):
def test_nonlive_mode_validation(flow, validate, caplog, log_filter):
"""Nonlive tasks return a warning at validation.
"""
msg1 = dedent('The following tasks are set to run in skip mode:\n * skip')
msg1 = dedent(
'The following tasks are set to run in skip mode:\n * skip'
)

wid = flow({
'scheduling': {
Expand Down Expand Up @@ -631,7 +633,9 @@ def test_skip_forbidden_as_output(flow, validate):
validate(wid)


def test_validate_workflow_run_mode(flow: Fixture, validate: Fixture, caplog: Fixture):
def test_validate_workflow_run_mode(
flow: Fixture, validate: Fixture, caplog: Fixture
):
"""Test that Cylc validate will only check simulation mode settings
if validate --mode simulation or dummy.
Discovered in:
Expand Down
5 changes: 2 additions & 3 deletions tests/integration/test_data_store_mgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import pytest

from cylc.flow.data_messages_pb2 import PbPrerequisite, PbTaskProxy
from cylc.flow.data_store_mgr import (
EDGES,
FAMILY_PROXIES,
Expand All @@ -28,7 +27,6 @@
WORKFLOW,
)
from cylc.flow.id import Tokens
from cylc.flow.scheduler import Scheduler
from cylc.flow.task_events_mgr import TaskEventsManager
from cylc.flow.task_outputs import (
TASK_OUTPUT_SUBMITTED,
Expand All @@ -45,6 +43,7 @@

if TYPE_CHECKING:
from cylc.flow.scheduler import Scheduler
from cylc.flow.data_messages_pb2 import PbPrerequisite, PbTaskProxy


# NOTE: Some of these tests mutate the data store, so running them in
Expand Down Expand Up @@ -99,7 +98,7 @@ def ext_id(schd):
return f'~{schd.owner}/{schd.workflow}//{int_id(None)}'


def get_pb_prereqs(schd: Scheduler) -> List[PbPrerequisite]:
def get_pb_prereqs(schd: 'Scheduler') -> 'List[PbPrerequisite]':
"""Get all protobuf prerequisites from the data store task proxies."""
return [
p
Expand Down
Loading