Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wxtim committed Apr 22, 2024
1 parent dca42fa commit 6ed24e9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cylc/flow/run_modes/nonlive.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ def mode_validate_checks(taskdefs: 'Dict[str, TaskDefs]'):
message += f'\n{mode} mode:'
for taskname in tasknames:
message += f'\n * {taskname}'
LOG.warn(message)
LOG.warning(message)
4 changes: 2 additions & 2 deletions cylc/flow/run_modes/skip.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def check_task_skip_config(name: str, tdef: 'TaskDef') -> None:
# Warn if started or submitted set:
unecessary_outs = get_unecessary_outputs(skip_outputs)
if unecessary_outs:
LOG.warn(
LOG.warning(
f'Task {name} has output(s) {unecessary_outs} which will'
' always be run in skip mode and need not be set.')

Expand All @@ -163,5 +163,5 @@ def get_unecessary_outputs(skip_outputs: List[str]) -> Set[str]:
"""
return {
o for o in skip_outputs
if o in [TASK_OUTPUT_STARTED, TASK_OUTPUT_SUBMITTED]
if o in {TASK_OUTPUT_SUBMITTED, TASK_OUTPUT_STARTED}
}
16 changes: 9 additions & 7 deletions tests/integration/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

from pathlib import Path
import re
import sqlite3
from textwrap import dedent
from typing import Any
Expand Down Expand Up @@ -509,19 +510,16 @@ def test_special_task_non_word_names(flow: Fixture, validate: Fixture):
def test_nonlive_mode_validation(flow, validate, caplog):
"""Nonlive tasks return a warning at validation.
"""
msgs = [dedent(
msg1 = dedent(
''' The following tasks are set to run in non-live mode:
skip mode:
* skip
simulation mode:
* simulation
dummy mode:
* dummy''')]
* dummy''')

msgs.append(
"Task skip has output(s) {'started', 'submitted'} which will"
" always be run in skip mode and need not be set."
)
msg2 = re.compile("Task skip has output")

wid = flow({
'scheduling': {
Expand All @@ -542,4 +540,8 @@ def test_nonlive_mode_validation(flow, validate, caplog):
})

validate(wid)
assert sorted(msgs) == sorted(caplog.messages)
assert msg1 in caplog.messages

messages = [msg for msg in caplog.messages if msg2.findall(msg)]
assert 'started' in messages[0]
assert 'submitted' in messages[0]

0 comments on commit 6ed24e9

Please sign in to comment.