From 71761af7e9ac748a96683254ceb6c8d0bfa84a00 Mon Sep 17 00:00:00 2001 From: TomekTrzeciak Date: Fri, 6 Dec 2024 00:09:48 +0000 Subject: [PATCH] allow workflow config to unset global events config --- cylc/flow/workflow_events.py | 2 +- tests/unit/test_workflow_events.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cylc/flow/workflow_events.py b/cylc/flow/workflow_events.py index 2b99ef3d2cf..704d604d2c4 100644 --- a/cylc/flow/workflow_events.py +++ b/cylc/flow/workflow_events.py @@ -235,7 +235,7 @@ def get_events_conf( glbl_cfg().get(['scheduler', 'mail']) ): value = getter.get(key) - if value is not None and value != []: + if value is not None: return value return default diff --git a/tests/unit/test_workflow_events.py b/tests/unit/test_workflow_events.py index 89449953f20..3aabc6de067 100644 --- a/tests/unit/test_workflow_events.py +++ b/tests/unit/test_workflow_events.py @@ -34,6 +34,9 @@ ('handlers', True, True, ['stall']), ('handlers', False, True, None), ('handlers', False, False, None), + ('mail events', True, True, []), + ('mail events', False, True, ['abort']), + ('mail events', False, False, None), ('from', True, True, 'docklands@railway'), ('from', False, True, 'highway@mixture'), ('from', False, False, None), @@ -55,13 +58,14 @@ def test_get_events_handler( from = highway@mixture [[events]] abort on workflow timeout = True + mail events = abort ''' ) config = SimpleNamespace() config.cfg = { 'scheduler': { - 'events': {'handlers': ['stall']}, + 'events': {'handlers': ['stall'], 'mail events': []}, 'mail': {'from': 'docklands@railway'}, } if workflow_cfg else {'events': {}} }