From 665bf9f66839ab1ca51b4161b6fc8903b5b7c94c Mon Sep 17 00:00:00 2001 From: Tim Pillinger <26465611+wxtim@users.noreply.github.com> Date: Fri, 27 Oct 2023 10:40:28 +0100 Subject: [PATCH 01/11] add generic Python 3 (i.e. A bleeding edge version) to tests --- .github/workflows/test_fast.yml | 2 +- .github/workflows/test_functional.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test_fast.yml b/.github/workflows/test_fast.yml index d0bff50326d..49f2f44b51f 100644 --- a/.github/workflows/test_fast.yml +++ b/.github/workflows/test_fast.yml @@ -20,7 +20,7 @@ jobs: fail-fast: false # Don't let a failed MacOS run stop the Ubuntu runs matrix: os: ['ubuntu-latest'] - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3'] include: - os: 'macos-latest' python-version: '3.7' diff --git a/.github/workflows/test_functional.yml b/.github/workflows/test_functional.yml index 75dac06a964..baaad6b61f3 100644 --- a/.github/workflows/test_functional.yml +++ b/.github/workflows/test_functional.yml @@ -46,9 +46,9 @@ jobs: # NOTE: includes must define ALL of the matrix values include: # latest python - - name: 'py-3.11' + - name: 'py-3-latest' os: 'ubuntu-latest' - python-version: '3.11' + python-version: '3' test-base: 'tests/f' chunk: '1/4' platform: '_local_background*' From 04ad456eefaab588f06a3d592164d9561478e84c Mon Sep 17 00:00:00 2001 From: Tim Pillinger <26465611+wxtim@users.noreply.github.com> Date: Fri, 27 Oct 2023 10:52:23 +0100 Subject: [PATCH 02/11] remove report timings from Python 3.12 --- cylc/flow/scripts/report_timings.py | 10 +++++++++- setup.cfg | 1 - 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/cylc/flow/scripts/report_timings.py b/cylc/flow/scripts/report_timings.py index 8d05ed2748d..fa57577c194 100755 --- a/cylc/flow/scripts/report_timings.py +++ b/cylc/flow/scripts/report_timings.py @@ -243,10 +243,18 @@ def write_category(self, buf, category, df_reshape, df_describe): pass def _check_imports(self): + if sys.version_info > (3, 11): + raise CylcError( + 'Cylc Report Timings is deprecated: It is incompatible' + ' with Python > 3.11' + ) try: import pandas except ImportError: - raise CylcError('Cannot import pandas - summary unavailable.') + raise CylcError( + 'Cannot import pandas - summary unavailable.' + ' try: pip install cylc-flow[report-timings]' + ) else: del pandas diff --git a/setup.cfg b/setup.cfg index 6581f341571..d5fd84a80b8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -141,7 +141,6 @@ all = %(main_loop-log_db)s %(main_loop-log_main_loop)s %(main_loop-log_memory)s - %(report-timings)s %(tests)s %(tutorials)s From ad511e46f7c6db0548e5b80ee770fdf61844f2f6 Mon Sep 17 00:00:00 2001 From: Tim Pillinger <26465611+wxtim@users.noreply.github.com> Date: Fri, 27 Oct 2023 15:28:35 +0100 Subject: [PATCH 03/11] fix flake8 issues --- changes.d/5794.break.md | 4 ++++ cylc/flow/cfgspec/globalcfg.py | 17 ++++++++++------- cylc/flow/cfgspec/workflow.py | 10 +++++----- cylc/flow/id.py | 2 +- 4 files changed, 20 insertions(+), 13 deletions(-) create mode 100644 changes.d/5794.break.md diff --git a/changes.d/5794.break.md b/changes.d/5794.break.md new file mode 100644 index 00000000000..d94865eda4f --- /dev/null +++ b/changes.d/5794.break.md @@ -0,0 +1,4 @@ +Remove `cylc report-timings` from automatic installation with +`pip install cylc-flow[all]`. If you now wish to +install it use `pip install cylc-flow[report-timings]`. + Cylc Report timings will no longer work at Python 3.12. \ No newline at end of file diff --git a/cylc/flow/cfgspec/globalcfg.py b/cylc/flow/cfgspec/globalcfg.py index 86c639af113..23dfffba244 100644 --- a/cylc/flow/cfgspec/globalcfg.py +++ b/cylc/flow/cfgspec/globalcfg.py @@ -1222,6 +1222,9 @@ def default_for( {PLATFORM_REPLACES.format("[job]batch system")} ''') + replaces = PLATFORM_REPLACES.format( + "[job]batch submit command template" + ) Conf('job runner command template', VDR.V_STRING, desc=f''' Set the command used by the chosen job runner. @@ -1230,9 +1233,7 @@ def default_for( .. versionadded:: 8.0.0 - {PLATFORM_REPLACES.format( - "[job]batch submit command template" - )} + {replaces} ''') Conf('shell', VDR.V_STRING, '/bin/bash', desc=''' @@ -1465,6 +1466,8 @@ def default_for( {REPLACES}``global.rc[hosts][]retrieve job logs command``. ''') + replaces = PLATFORM_REPLACES.format( + "[remote]retrieve job logs max size") Conf('retrieve job logs max size', VDR.V_STRING, desc=f''' {LOG_RETR_SETTINGS['retrieve job logs max size']} @@ -1472,9 +1475,10 @@ def default_for( {REPLACES}``global.rc[hosts][]retrieve job logs max size``. - {PLATFORM_REPLACES.format( - "[remote]retrieve job logs max size")} + {replaces} ''') + replaces = PLATFORM_REPLACES.format( + "[remote]retrieve job logs retry delays") Conf('retrieve job logs retry delays', VDR.V_INTERVAL_LIST, desc=f''' {LOG_RETR_SETTINGS['retrieve job logs retry delays']} @@ -1483,8 +1487,7 @@ def default_for( {REPLACES}``global.rc[hosts][]retrieve job logs retry delays``. - {PLATFORM_REPLACES.format( - "[remote]retrieve job logs retry delays")} + {replaces} ''') Conf('tail command template', VDR.V_STRING, 'tail -n +1 --follow=name %(filename)s', diff --git a/cylc/flow/cfgspec/workflow.py b/cylc/flow/cfgspec/workflow.py index f521614c73a..d75013fd621 100644 --- a/cylc/flow/cfgspec/workflow.py +++ b/cylc/flow/cfgspec/workflow.py @@ -401,7 +401,7 @@ def get_script_common_text(this: str, example: Optional[str] = None): # differentiate between not set vs set to empty default = None elif item.endswith("handlers"): - desc = desc + '\n\n' + dedent(rf''' + desc = desc + '\n\n' + dedent(f''' Examples: .. code-block:: cylc @@ -413,9 +413,9 @@ def get_script_common_text(this: str, example: Optional[str] = None): {item} = echo %(workflow)s # configure multiple event handlers - {item} = \ - 'echo %(workflow)s, %(event)s', \ - 'my_exe %(event)s %(message)s' \ + {item} = \\ + 'echo %(workflow)s, %(event)s', \\ + 'my_exe %(event)s %(message)s' \\ 'curl -X PUT -d event=%(event)s host:port' ''') elif item.startswith("abort on"): @@ -1856,7 +1856,7 @@ def upg(cfg, descr): ['scheduling', 'max active cycle points'], ['scheduling', 'runahead limit'], cvtr=converter( - lambda x: f'P{int(x)-1}' if x != '' else '', + lambda x: f'P{int(x) - 1}' if x != '' else '', '"{old}" -> "{new}"' ), silent=cylc.flow.flags.cylc7_back_compat, diff --git a/cylc/flow/id.py b/cylc/flow/id.py index b8f34fb217f..222d16f82b6 100644 --- a/cylc/flow/id.py +++ b/cylc/flow/id.py @@ -497,7 +497,7 @@ def duplicate( )? (?: # cycle/task/job - { RELATIVE_PATTERN } + {RELATIVE_PATTERN} )? )? )? From 85449a48c931986cdbffbbc037a2542cdc4be087 Mon Sep 17 00:00:00 2001 From: Tim Pillinger <26465611+wxtim@users.noreply.github.com> Date: Mon, 30 Oct 2023 11:19:36 +0000 Subject: [PATCH 04/11] Response to review Co-authored-by: Ronnie Dutta <61982285+MetRonnie@users.noreply.github.com> --- changes.d/5794.break.md | 5 +---- cylc/flow/scripts/report_timings.py | 9 ++++----- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/changes.d/5794.break.md b/changes.d/5794.break.md index d94865eda4f..53c5315b013 100644 --- a/changes.d/5794.break.md +++ b/changes.d/5794.break.md @@ -1,4 +1 @@ -Remove `cylc report-timings` from automatic installation with -`pip install cylc-flow[all]`. If you now wish to -install it use `pip install cylc-flow[report-timings]`. - Cylc Report timings will no longer work at Python 3.12. \ No newline at end of file +Remove `cylc report-timings` from automatic installation with `pip install cylc-flow[all]`. If you now wish to install it use `pip install cylc-flow[report-timings]`. `cylc report-timings` is incompatible with Python 3.12. \ No newline at end of file diff --git a/cylc/flow/scripts/report_timings.py b/cylc/flow/scripts/report_timings.py index fa57577c194..e024f231b2a 100755 --- a/cylc/flow/scripts/report_timings.py +++ b/cylc/flow/scripts/report_timings.py @@ -54,6 +54,8 @@ import sys from typing import TYPE_CHECKING + +from cylc.flow import LOG from cylc.flow.exceptions import CylcError from cylc.flow.id_cli import parse_id from cylc.flow.option_parsers import ( @@ -123,6 +125,8 @@ def main(parser: COP, options: 'Values', workflow_id: str) -> None: constraint='workflows', ) + LOG.warning('Cylc report-timings is will be retired soon.') + output_options = [ options.show_raw, options.show_summary, options.html_summary ] @@ -243,11 +247,6 @@ def write_category(self, buf, category, df_reshape, df_describe): pass def _check_imports(self): - if sys.version_info > (3, 11): - raise CylcError( - 'Cylc Report Timings is deprecated: It is incompatible' - ' with Python > 3.11' - ) try: import pandas except ImportError: From 4b595d20ec14fb777b2466a704f196ecb8ad67f0 Mon Sep 17 00:00:00 2001 From: Tim Pillinger <26465611+wxtim@users.noreply.github.com> Date: Mon, 30 Oct 2023 11:24:51 +0000 Subject: [PATCH 05/11] remove possibly unwanted flake8 fix From e9d035fa01e86c8f282d1df909e96ec8bd7216bf Mon Sep 17 00:00:00 2001 From: Tim Pillinger <26465611+wxtim@users.noreply.github.com> Date: Mon, 30 Oct 2023 19:30:19 +0000 Subject: [PATCH 06/11] Update cylc/flow/scripts/report_timings.py Co-authored-by: Ronnie Dutta <61982285+MetRonnie@users.noreply.github.com> --- cylc/flow/scripts/report_timings.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cylc/flow/scripts/report_timings.py b/cylc/flow/scripts/report_timings.py index e024f231b2a..b6d796ad732 100755 --- a/cylc/flow/scripts/report_timings.py +++ b/cylc/flow/scripts/report_timings.py @@ -125,7 +125,11 @@ def main(parser: COP, options: 'Values', workflow_id: str) -> None: constraint='workflows', ) - LOG.warning('Cylc report-timings is will be retired soon.') + LOG.warning( + "cylc report-timings is deprecated." + " The analysis view in the GUI provides" + " similar functionality." + ) output_options = [ options.show_raw, options.show_summary, options.html_summary From 3183cabb262d0bdbabc5cc84700d827341fe9e07 Mon Sep 17 00:00:00 2001 From: WXTIM <26465611+wxtim@users.noreply.github.com> Date: Fri, 3 Nov 2023 13:53:51 +0000 Subject: [PATCH 07/11] Commented out broken test lines (see issue 5812) --- tests/unit/test_indep_task_queues.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/unit/test_indep_task_queues.py b/tests/unit/test_indep_task_queues.py index a0a1894cece..bb11fbce463 100644 --- a/tests/unit/test_indep_task_queues.py +++ b/tests/unit/test_indep_task_queues.py @@ -92,9 +92,10 @@ def test_queue_and_release( assert sorted([r.tdef.name for r in released]) == sorted(expected_released) # check released tasks change state to "preparing", and not is_queued - for r in released: - assert r.state.reset.called_with(TASK_STATUS_PREPARING) - assert r.state.reset.called_with(is_queued=False) + # Commented out pending https://github.com/cylc/cylc-flow/issues/5812 + # for r in released: + # assert r.state.reset.called_with(TASK_STATUS_PREPARING) + # assert r.state.reset.called_with(is_queued=False) # check that adopted orphans end up in the default queue orphans = ["orphan1", "orphan2"] From 8636bf3fe8df03d5c5810a3a7cffe787d3275ac2 Mon Sep 17 00:00:00 2001 From: WXTIM <26465611+wxtim@users.noreply.github.com> Date: Mon, 6 Nov 2023 12:44:40 +0000 Subject: [PATCH 08/11] replace smtpd with aiosmtpd in the test_header file --- setup.cfg | 1 + tests/functional/events/18-workflow-event-mail.t | 12 ++++-------- tests/functional/lib/bash/test_header | 7 +++++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/setup.cfg b/setup.cfg index d5fd84a80b8..258081301c9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -103,6 +103,7 @@ report-timings = pandas==1.* matplotlib tests = + aiosmtpd async_generator bandit>=1.7.0 coverage>=5.0.0,<7.3.1 diff --git a/tests/functional/events/18-workflow-event-mail.t b/tests/functional/events/18-workflow-event-mail.t index fcde6da0bd7..0ed3b90d7d9 100755 --- a/tests/functional/events/18-workflow-event-mail.t +++ b/tests/functional/events/18-workflow-event-mail.t @@ -20,7 +20,7 @@ if ! command -v mail 2>'/dev/null'; then skip_all '"mail" command not available' fi -set_test_number 3 +set_test_number 7 mock_smtpd_init OPT_SET= if [[ "${TEST_NAME_BASE}" == *-globalcfg ]]; then @@ -48,13 +48,9 @@ run_ok "${TEST_NAME_BASE}-validate" \ workflow_run_ok "${TEST_NAME_BASE}-run" \ cylc play --reference-test --debug --no-detach ${OPT_SET} "${WORKFLOW_NAME}" -contains_ok "${TEST_SMTPD_LOG}" <<__LOG__ -b'event: startup' -b'message: workflow starting' -b'event: shutdown' -b'message: AUTOMATIC' -b'see: http://localhost/stuff/${USER}/${WORKFLOW_NAME}/' -__LOG__ +for searchterm in 'event: startup' 'message: workflow starting' 'event: shutdown' 'message: AUTOMATIC' "see: http://localhost/stuff/${USER}/${WORKFLOW_NAME}/"; do + grep_ok "$searchterm" "$TEST_SMTPD_LOG" +done purge mock_smtpd_kill diff --git a/tests/functional/lib/bash/test_header b/tests/functional/lib/bash/test_header index 458a7dc908c..c4a07603126 100644 --- a/tests/functional/lib/bash/test_header +++ b/tests/functional/lib/bash/test_header @@ -807,10 +807,13 @@ mock_smtpd_init() { # Logic borrowed from Rose local SMTPD_LOG="${TEST_DIR}/smtpd.log" local SMTPD_HOST="localhost:${SMTPD_PORT}" # Set up fake SMTP server to catch outgoing mail & redirect to log: - python3 -u -m 'smtpd' -c 'DebuggingServer' -d -n "${SMTPD_HOST}" \ + python3 -u -m 'aiosmtpd' \ + --class aiosmtpd.handlers.Debugging stdout \ + --debug --nosetuid \ + --listen "${SMTPD_HOST}" \ 1>"${SMTPD_LOG}" 2>&1 & # Runs in background local SMTPD_PID="$!" - while ! grep -q 'DebuggingServer started' "${SMTPD_LOG}" 2>'/dev/null' + while ! grep -q 'is listening' "${SMTPD_LOG}" 2>'/dev/null' do if ps "${SMTPD_PID}" 1>/dev/null 2>&1; then sleep 1 # Still waiting for fake server to start From 6d7509e523cd91ddd24830651a459e093b3509fb Mon Sep 17 00:00:00 2001 From: Tim Pillinger <26465611+wxtim@users.noreply.github.com> Date: Tue, 7 Nov 2023 15:49:18 +0000 Subject: [PATCH 09/11] fix tests --- tests/functional/events/09-task-event-mail.t | 25 ++++++---- .../functional/events/29-task-event-mail-1.t | 17 ++++--- .../functional/events/30-task-event-mail-2.t | 47 ++++++++++--------- 3 files changed, 51 insertions(+), 38 deletions(-) diff --git a/tests/functional/events/09-task-event-mail.t b/tests/functional/events/09-task-event-mail.t index fb95c228a68..76fc11e548e 100755 --- a/tests/functional/events/09-task-event-mail.t +++ b/tests/functional/events/09-task-event-mail.t @@ -20,7 +20,7 @@ if ! command -v mail 2>'/dev/null'; then skip_all '"mail" command not available' fi -set_test_number 5 +set_test_number 6 mock_smtpd_init OPT_SET= if [[ "${TEST_NAME_BASE}" == *-globalcfg ]]; then @@ -49,15 +49,20 @@ run_ok "${TEST_NAME_BASE}-validate" \ workflow_run_ok "${TEST_NAME_BASE}-run" \ cylc play --reference-test --debug --no-detach ${OPT_SET} "${WORKFLOW_NAME}" -contains_ok "${TEST_SMTPD_LOG}" <<__LOG__ -b'retry: 1/t1/01' -b'succeeded: 1/t1/02' -b'see: http://localhost/stuff/${USER}/${WORKFLOW_NAME}/' -__LOG__ -run_ok "${TEST_NAME_BASE}-grep-log" \ - grep -q "Subject: \\[1/t1/01 retry\\].* ${WORKFLOW_NAME}" "${TEST_SMTPD_LOG}" -run_ok "${TEST_NAME_BASE}-grep-log" \ - grep -q "Subject: \\[1/t1/02 succeeded\\].* ${WORKFLOW_NAME}" "${TEST_SMTPD_LOG}" +grep_ok 'retry: 1/t1/01' "${TEST_SMTPD_LOG}" +grep_ok 'succeeded: 1/t1/02' "${TEST_SMTPD_LOG}" +grep_ok "see: http://localhost/stuff/${USER}/${WORKFLOW_NAME}/" "${TEST_SMTPD_LOG}" +cat $TEST_SMTPD_LOG > /home/h02/tpilling/foo + +grep 'Subject:' "${TEST_SMTPD_LOG}" -A1 > selection.log + +cmp_ok selection.log <<__HERE__ +Subject: [1/t1/01 retry] + ${WORKFLOW_NAME} +-- +Subject: [1/t1/02 succeeded] + ${WORKFLOW_NAME} +__HERE__ purge mock_smtpd_kill diff --git a/tests/functional/events/29-task-event-mail-1.t b/tests/functional/events/29-task-event-mail-1.t index b6669ea8741..d4dada66fd6 100755 --- a/tests/functional/events/29-task-event-mail-1.t +++ b/tests/functional/events/29-task-event-mail-1.t @@ -20,7 +20,7 @@ if ! command -v mail 2>'/dev/null'; then skip_all '"mail" command not available' fi -set_test_number 4 +set_test_number 5 mock_smtpd_init create_test_global_config " @@ -37,12 +37,15 @@ run_ok "${TEST_NAME_BASE}-validate" \ workflow_run_ok "${TEST_NAME_BASE}-run" \ cylc play --reference-test --debug --no-detach "$WORKFLOW_NAME" -contains_ok "${TEST_SMTPD_LOG}" <<__LOG__ -b'retry: 1/t1/01' -b'see: http://localhost/stuff/${USER}/${WORKFLOW_NAME}/' -__LOG__ -run_ok "${TEST_NAME_BASE}-grep-log" \ - grep -q "Subject: \\[1/t1/01 retry\\].* ${WORKFLOW_NAME}" "${TEST_SMTPD_LOG}" +grep_ok "retry: 1/t1/01" "${TEST_SMTPD_LOG}" +grep_ok "see: http://localhost/stuff/${USER}/${WORKFLOW_NAME}/" "${TEST_SMTPD_LOG}" + +grep 'Subject:' "${TEST_SMTPD_LOG}" -A1 > selection.log + +cmp_ok selection.log <<__HERE__ +Subject: [1/t1/01 retry] + ${WORKFLOW_NAME} +__HERE__ purge mock_smtpd_kill diff --git a/tests/functional/events/30-task-event-mail-2.t b/tests/functional/events/30-task-event-mail-2.t index 6e8ff8a1e86..ef50f530806 100755 --- a/tests/functional/events/30-task-event-mail-2.t +++ b/tests/functional/events/30-task-event-mail-2.t @@ -20,7 +20,7 @@ if ! command -v mail 2>'/dev/null'; then skip_all '"mail" command not available' fi -set_test_number 5 +set_test_number 36 mock_smtpd_init OPT_SET= if [[ "${TEST_NAME_BASE}" == *-globalcfg ]]; then @@ -49,28 +49,33 @@ run_ok "${TEST_NAME_BASE}-validate" \ workflow_run_fail "${TEST_NAME_BASE}-run" \ cylc play --reference-test --debug --no-detach ${OPT_SET} "${WORKFLOW_NAME}" -contains_ok "${TEST_SMTPD_LOG}" <<__LOG__ -b'retry: 1/t1/01' -b'retry: 1/t2/01' -b'retry: 1/t3/01' -b'retry: 1/t4/01' -b'retry: 1/t5/01' -b'retry: 1/t1/02' -b'retry: 1/t2/02' -b'retry: 1/t3/02' -b'retry: 1/t4/02' -b'retry: 1/t5/02' -b'failed: 1/t1/03' -b'failed: 1/t2/03' -b'failed: 1/t3/03' -b'failed: 1/t4/03' -b'failed: 1/t5/03' -b'see: http://localhost/stuff/${USER}/${WORKFLOW_NAME}/' -__LOG__ +labels=( +'retry: 1/t1/01' +'retry: 1/t2/01' +'retry: 1/t3/01' +'retry: 1/t4/01' +'retry: 1/t5/01' +'retry: 1/t1/02' +'retry: 1/t2/02' +'retry: 1/t3/02' +'retry: 1/t4/02' +'retry: 1/t5/02' +'failed: 1/t1/03' +'failed: 1/t2/03' +'failed: 1/t3/03' +'failed: 1/t4/03' +'failed: 1/t5/03' +"see: http://localhost/stuff/${USER}/${WORKFLOW_NAME}/") + +for label in ${labels[@]}; do +grep_ok "$label" "${TEST_SMTPD_LOG}" +done + run_ok "${TEST_NAME_BASE}-grep-log" \ - grep -q "Subject: \\[. tasks retry\\].* ${WORKFLOW_NAME}" "${TEST_SMTPD_LOG}" + grep -q "Subject: \\[. tasks retry\\]" "${TEST_SMTPD_LOG}" run_ok "${TEST_NAME_BASE}-grep-log" \ - grep -q "Subject: \\[. tasks failed\\].* ${WORKFLOW_NAME}" "${TEST_SMTPD_LOG}" + grep -q "Subject: \\[. tasks failed\\]" "${TEST_SMTPD_LOG}" + purge mock_smtpd_kill exit From b7de31001f2517c09b0883082ca04899d70f4e89 Mon Sep 17 00:00:00 2001 From: Tim Pillinger <26465611+wxtim@users.noreply.github.com> Date: Tue, 7 Nov 2023 15:54:05 +0000 Subject: [PATCH 10/11] Undo some over-zealous changes to tests. --- setup.cfg | 1 + tests/functional/events/09-task-event-mail.t | 24 ++++------ .../events/18-workflow-event-mail.t | 12 +++-- .../functional/events/29-task-event-mail-1.t | 17 +++---- .../functional/events/30-task-event-mail-2.t | 47 +++++++++---------- 5 files changed, 50 insertions(+), 51 deletions(-) diff --git a/setup.cfg b/setup.cfg index 258081301c9..48d940a6a29 100644 --- a/setup.cfg +++ b/setup.cfg @@ -52,6 +52,7 @@ classifiers = Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 Programming Language :: Python :: 3 :: Only Programming Language :: Python :: Implementation :: CPython Topic :: Scientific/Engineering :: Atmospheric Science diff --git a/tests/functional/events/09-task-event-mail.t b/tests/functional/events/09-task-event-mail.t index 76fc11e548e..a689268ea1d 100755 --- a/tests/functional/events/09-task-event-mail.t +++ b/tests/functional/events/09-task-event-mail.t @@ -20,7 +20,7 @@ if ! command -v mail 2>'/dev/null'; then skip_all '"mail" command not available' fi -set_test_number 6 +set_test_number 5 mock_smtpd_init OPT_SET= if [[ "${TEST_NAME_BASE}" == *-globalcfg ]]; then @@ -49,20 +49,16 @@ run_ok "${TEST_NAME_BASE}-validate" \ workflow_run_ok "${TEST_NAME_BASE}-run" \ cylc play --reference-test --debug --no-detach ${OPT_SET} "${WORKFLOW_NAME}" -grep_ok 'retry: 1/t1/01' "${TEST_SMTPD_LOG}" -grep_ok 'succeeded: 1/t1/02' "${TEST_SMTPD_LOG}" -grep_ok "see: http://localhost/stuff/${USER}/${WORKFLOW_NAME}/" "${TEST_SMTPD_LOG}" -cat $TEST_SMTPD_LOG > /home/h02/tpilling/foo +contains_ok "${TEST_SMTPD_LOG}" <<__LOG__ +retry: 1/t1/01 +succeeded: 1/t1/02 +see: http://localhost/stuff/${USER}/${WORKFLOW_NAME}/ +__LOG__ -grep 'Subject:' "${TEST_SMTPD_LOG}" -A1 > selection.log - -cmp_ok selection.log <<__HERE__ -Subject: [1/t1/01 retry] - ${WORKFLOW_NAME} --- -Subject: [1/t1/02 succeeded] - ${WORKFLOW_NAME} -__HERE__ +run_ok "${TEST_NAME_BASE}-grep-log" \ + grep -qPizo "Subject: \[1/t1/01 retry\]\n ${WORKFLOW_NAME}" "${TEST_SMTPD_LOG}" +run_ok "${TEST_NAME_BASE}-grep-log" \ + grep -qPizo "Subject: \[1/t1/02 succeeded\]\n ${WORKFLOW_NAME}" "${TEST_SMTPD_LOG}" purge mock_smtpd_kill diff --git a/tests/functional/events/18-workflow-event-mail.t b/tests/functional/events/18-workflow-event-mail.t index 0ed3b90d7d9..eae45962db0 100755 --- a/tests/functional/events/18-workflow-event-mail.t +++ b/tests/functional/events/18-workflow-event-mail.t @@ -20,7 +20,7 @@ if ! command -v mail 2>'/dev/null'; then skip_all '"mail" command not available' fi -set_test_number 7 +set_test_number 3 mock_smtpd_init OPT_SET= if [[ "${TEST_NAME_BASE}" == *-globalcfg ]]; then @@ -48,9 +48,13 @@ run_ok "${TEST_NAME_BASE}-validate" \ workflow_run_ok "${TEST_NAME_BASE}-run" \ cylc play --reference-test --debug --no-detach ${OPT_SET} "${WORKFLOW_NAME}" -for searchterm in 'event: startup' 'message: workflow starting' 'event: shutdown' 'message: AUTOMATIC' "see: http://localhost/stuff/${USER}/${WORKFLOW_NAME}/"; do - grep_ok "$searchterm" "$TEST_SMTPD_LOG" -done +contains_ok "${TEST_SMTPD_LOG}" <<__LOG__ +event: startup +message: workflow starting +event: shutdown +message: AUTOMATIC +see: http://localhost/stuff/${USER}/${WORKFLOW_NAME}/ +__LOG__ purge mock_smtpd_kill diff --git a/tests/functional/events/29-task-event-mail-1.t b/tests/functional/events/29-task-event-mail-1.t index d4dada66fd6..732e585e317 100755 --- a/tests/functional/events/29-task-event-mail-1.t +++ b/tests/functional/events/29-task-event-mail-1.t @@ -20,7 +20,7 @@ if ! command -v mail 2>'/dev/null'; then skip_all '"mail" command not available' fi -set_test_number 5 +set_test_number 4 mock_smtpd_init create_test_global_config " @@ -37,15 +37,16 @@ run_ok "${TEST_NAME_BASE}-validate" \ workflow_run_ok "${TEST_NAME_BASE}-run" \ cylc play --reference-test --debug --no-detach "$WORKFLOW_NAME" -grep_ok "retry: 1/t1/01" "${TEST_SMTPD_LOG}" -grep_ok "see: http://localhost/stuff/${USER}/${WORKFLOW_NAME}/" "${TEST_SMTPD_LOG}" -grep 'Subject:' "${TEST_SMTPD_LOG}" -A1 > selection.log +contains_ok "${TEST_SMTPD_LOG}" <<__LOG__ +retry: 1/t1/01 +see: http://localhost/stuff/${USER}/${WORKFLOW_NAME}/ +__LOG__ -cmp_ok selection.log <<__HERE__ -Subject: [1/t1/01 retry] - ${WORKFLOW_NAME} -__HERE__ +cat ${TEST_SMTPD_LOG} > ${HOME}/foo + +run_ok "${TEST_NAME_BASE}-grep-log" \ + grep -qPizo "Subject: \[1/t1/01 retry\]\n ${WORKFLOW_NAME}" "${TEST_SMTPD_LOG}" purge mock_smtpd_kill diff --git a/tests/functional/events/30-task-event-mail-2.t b/tests/functional/events/30-task-event-mail-2.t index ef50f530806..10ef0119892 100755 --- a/tests/functional/events/30-task-event-mail-2.t +++ b/tests/functional/events/30-task-event-mail-2.t @@ -20,7 +20,7 @@ if ! command -v mail 2>'/dev/null'; then skip_all '"mail" command not available' fi -set_test_number 36 +set_test_number 5 mock_smtpd_init OPT_SET= if [[ "${TEST_NAME_BASE}" == *-globalcfg ]]; then @@ -49,33 +49,30 @@ run_ok "${TEST_NAME_BASE}-validate" \ workflow_run_fail "${TEST_NAME_BASE}-run" \ cylc play --reference-test --debug --no-detach ${OPT_SET} "${WORKFLOW_NAME}" -labels=( -'retry: 1/t1/01' -'retry: 1/t2/01' -'retry: 1/t3/01' -'retry: 1/t4/01' -'retry: 1/t5/01' -'retry: 1/t1/02' -'retry: 1/t2/02' -'retry: 1/t3/02' -'retry: 1/t4/02' -'retry: 1/t5/02' -'failed: 1/t1/03' -'failed: 1/t2/03' -'failed: 1/t3/03' -'failed: 1/t4/03' -'failed: 1/t5/03' -"see: http://localhost/stuff/${USER}/${WORKFLOW_NAME}/") - -for label in ${labels[@]}; do -grep_ok "$label" "${TEST_SMTPD_LOG}" -done +contains_ok "${TEST_SMTPD_LOG}" <<__LOG__ +retry: 1/t1/01 +retry: 1/t2/01 +retry: 1/t3/01 +retry: 1/t4/01 +retry: 1/t5/01 +retry: 1/t1/02 +retry: 1/t2/02 +retry: 1/t3/02 +retry: 1/t4/02 +retry: 1/t5/02 +failed: 1/t1/03 +failed: 1/t2/03 +failed: 1/t3/03 +failed: 1/t4/03 +failed: 1/t5/03 +see: http://localhost/stuff/${USER}/${WORKFLOW_NAME}/ +__LOG__ run_ok "${TEST_NAME_BASE}-grep-log" \ - grep -q "Subject: \\[. tasks retry\\]" "${TEST_SMTPD_LOG}" + grep -qPizo "Subject: \[. tasks retry\]\n ${WORKFLOW_NAME}" "${TEST_SMTPD_LOG}" run_ok "${TEST_NAME_BASE}-grep-log" \ - grep -q "Subject: \\[. tasks failed\\]" "${TEST_SMTPD_LOG}" + grep -qPizo "Subject: \[. tasks failed\]\n ${WORKFLOW_NAME}" "${TEST_SMTPD_LOG}" -purge + purge mock_smtpd_kill exit From bbe0d797671747ffa0c229d231329d1f123601de Mon Sep 17 00:00:00 2001 From: Tim Pillinger <26465611+wxtim@users.noreply.github.com> Date: Fri, 10 Nov 2023 09:38:46 +0000 Subject: [PATCH 11/11] Update tests/functional/events/29-task-event-mail-1.t Co-authored-by: Ronnie Dutta <61982285+MetRonnie@users.noreply.github.com> --- tests/functional/events/29-task-event-mail-1.t | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/functional/events/29-task-event-mail-1.t b/tests/functional/events/29-task-event-mail-1.t index 732e585e317..bef890c9c71 100755 --- a/tests/functional/events/29-task-event-mail-1.t +++ b/tests/functional/events/29-task-event-mail-1.t @@ -43,8 +43,6 @@ retry: 1/t1/01 see: http://localhost/stuff/${USER}/${WORKFLOW_NAME}/ __LOG__ -cat ${TEST_SMTPD_LOG} > ${HOME}/foo - run_ok "${TEST_NAME_BASE}-grep-log" \ grep -qPizo "Subject: \[1/t1/01 retry\]\n ${WORKFLOW_NAME}" "${TEST_SMTPD_LOG}"