diff --git a/cylc/flow/xtriggers/workflow_state.py b/cylc/flow/xtriggers/workflow_state.py index ca0a96a9aed..a55d5038886 100644 --- a/cylc/flow/xtriggers/workflow_state.py +++ b/cylc/flow/xtriggers/workflow_state.py @@ -114,9 +114,7 @@ def validate(args: Dict[str, Any]): raise WorkflowConfigError( "Full ID needed: workflow//cycle/task[:selector].") - try: - int(args["flow_num"]) - except ValueError: + if not isinstance(args["flow_num"], int): raise WorkflowConfigError("flow_num must be an integer.") diff --git a/tests/unit/xtriggers/test_workflow_state.py b/tests/unit/xtriggers/test_workflow_state.py index cd537a11b7d..95a20f8b8c2 100644 --- a/tests/unit/xtriggers/test_workflow_state.py +++ b/tests/unit/xtriggers/test_workflow_state.py @@ -288,7 +288,7 @@ def test_validate_fail_bad_id(id_): def test_validate_fail_non_int_flow(): """Validate returns ok with valid args.""" - with pytest.raises(ValueError, match='must be an integer'): + with pytest.raises(WorkflowConfigError, match='must be an integer'): validate({ 'workflow_task_id': 'foo//1/bar', 'offset': 'PT1H',