From 335bc4f2297bab070e1da5117e1ddfb588c0d362 Mon Sep 17 00:00:00 2001 From: Tim Pillinger <26465611+wxtim@users.noreply.github.com> Date: Mon, 16 Dec 2024 10:17:59 +0000 Subject: [PATCH] Sort pairs to make errors deterministic. --- cylc/flow/graph_parser.py | 2 +- tests/unit/test_graph_parser.py | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/cylc/flow/graph_parser.py b/cylc/flow/graph_parser.py index dad8c5aeff..46e3311478 100644 --- a/cylc/flow/graph_parser.py +++ b/cylc/flow/graph_parser.py @@ -473,7 +473,7 @@ def parse_graph(self, graph_string: str) -> None: pairs_dict = dict(pairs) terminals = set(pairs_dict.values()).difference(pairs_dict.keys()) - for pair in pairs: + for pair in sorted(pairs, key=lambda p: str(p[0])): self._proc_dep_pair(pair, terminals) @classmethod diff --git a/tests/unit/test_graph_parser.py b/tests/unit/test_graph_parser.py index e305ce11c3..438d7e5f83 100644 --- a/tests/unit/test_graph_parser.py +++ b/tests/unit/test_graph_parser.py @@ -161,12 +161,7 @@ def test_graph_syntax_errors_2(seq, graph, expected_err): ), param( "foo[-P1]:succeeded? | foo[-P1]:failed? => foo", - # Order of processing can result in different error messages - # (a) foo:succeeded can't be both optional and required - # (b) foo:succeeded and foo:failed most both be optional - # if both are used. - # The word "optional" is common to both. Not ideal! - 'optional', + 'Output foo:succeeded can\'t be both required and optional', id='succeed-or-failed-implies-success-optional' ), ]