Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Python 3.12 #5794

Merged
merged 12 commits into from
Nov 13, 2023
Merged

Conversation

wxtim
Copy link
Member

@wxtim wxtim commented Oct 27, 2023

  • Add tests to ensure that we test with the latest Python version.
  • Make cylc report timings emit a warning that it is deprecated if Python < 3.12, else it is obsolete, and emit an error to that effect.
  • Fix Flake 8 Failures.
  • Replace smtpd (deprecated at Python 3.6, removed at 3.12) with aiosmtpd.

Check List

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.
  • Contains logically grouped changes (else tidy your branch by rebase).
  • Does not contain off-topic changes (use other PRs for other changes).
  • Applied any dependency changes to both setup.cfg (and conda-environment.yml if present).
  • Tests are included: PR is a test enhancement.
  • CHANGES.md entry included if this is a change that can affect users
  • Cylc-Doc pull request opened if required at cylc/cylc-doc/pull/XXXX.
  • If this is a bug fix, PR should be raised against the relevant ?.?.x branch.

@wxtim wxtim force-pushed the add_generic_python_3_to_tests branch from c7a6a8e to 04ad456 Compare October 27, 2023 10:34
@wxtim wxtim force-pushed the add_generic_python_3_to_tests branch from 7133baf to ad511e4 Compare October 27, 2023 14:37
@wxtim wxtim self-assigned this Oct 27, 2023
@wxtim wxtim added this to the cylc-8.3.0 milestone Oct 27, 2023
@wxtim wxtim added config change Involves a change to global or workflow config dependencies labels Oct 27, 2023
@wxtim wxtim marked this pull request as ready for review October 27, 2023 14:39
changes.d/5794.break.md Outdated Show resolved Hide resolved
@MetRonnie MetRonnie changed the title add generic Python 3 (i.e. A bleeding edge version) to tests Add latest Python 3 to tests Oct 27, 2023
@MetRonnie MetRonnie added infrastructure GH Actions, Codecov etc. and removed config change Involves a change to global or workflow config labels Oct 27, 2023
@MetRonnie
Copy link
Member

P.S. the config change Involves a change to global or workflow config label is meant for changes that actually change the config

Co-authored-by: Ronnie Dutta <[email protected]>
@wxtim wxtim force-pushed the add_generic_python_3_to_tests branch from e81b6b4 to 85449a4 Compare October 30, 2023 11:22
@wxtim wxtim force-pushed the add_generic_python_3_to_tests branch from 9400835 to 4b595d2 Compare October 30, 2023 11:44
@wxtim wxtim requested a review from MetRonnie October 30, 2023 19:31
cylc/flow/cfgspec/globalcfg.py Show resolved Hide resolved
cylc/flow/cfgspec/globalcfg.py Show resolved Hide resolved
cylc/flow/cfgspec/globalcfg.py Show resolved Hide resolved
@MetRonnie
Copy link
Member

MetRonnie commented Oct 31, 2023

One test failure

tests/unit/test_indep_task_queues.py::test_queue_and_release[active0-expected_released0-expected_foo_groups0] - AttributeError: 'called_with' is not a valid assertion. Use a spec for the mock if 'called_with' is meant to be an attribute.

@MetRonnie
Copy link
Member

AttributeError: 'called_with' is not a valid assertion

diff --git a/tests/unit/test_indep_task_queues.py b/tests/unit/test_indep_task_queues.py
index a0a1894ce..7838a109e 100644
--- a/tests/unit/test_indep_task_queues.py
+++ b/tests/unit/test_indep_task_queues.py
@@ -94,6 +94,6 @@ def test_queue_and_release(
     # 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)
+        r.state.reset.assert_called_with(TASK_STATUS_PREPARING)
+        r.state.reset.assert_called_with(is_queued=False)
 
     # check that adopted orphans end up in the default queue

@MetRonnie
Copy link
Member

From Tim on Element:

Bother: I've found another problem with the Python 3.12 upgrade branch:

(tl;dr smtpd has been removed at Python 3.12: We need to use aiosmtpd - I'm investigating)

At 3.11

/home/tim/mambaforge/envs/cylc.dev.3.11/lib/python3.11/smtpd.py:96: DeprecationWarning: The asyncore module is deprecated and will be removed in Python 3.12. The recommended replacement is asyncio
  import asyncore
/home/tim/mambaforge/envs/cylc.dev.3.11/lib/python3.11/smtpd.py:97: DeprecationWarning: The asynchat module is deprecated and will be removed in Python 3.12. The recommended replacement is asyncio
  import asynchat
DebuggingServer started at Mon Nov  6 12:05:29 2023
	Local addr: ('localhost', 8025)
	Remote addr:('localhost', 25)

At 3.12

/home/tim/mambaforge/envs/cylc.dev/bin/python3: No module named smtpd

@MetRonnie MetRonnie marked this pull request as draft November 6, 2023 12:30
@wxtim wxtim force-pushed the add_generic_python_3_to_tests branch 2 times, most recently from da88b62 to d80996e Compare November 6, 2023 15:02
… into add_generic_python_3_to_tests

* 'add_generic_python_3_to_tests' of github.com:wxtim/cylc:
  replace smtpd with aiosmtpd in the test_header file
  Commented out broken test lines (see issue 5812)
  Update cylc/flow/scripts/report_timings.py
@wxtim wxtim marked this pull request as ready for review November 8, 2023 10:26
setup.cfg Outdated Show resolved Hide resolved
@MetRonnie MetRonnie changed the title Add latest Python 3 to tests Support Python 3.12 Nov 8, 2023
@oliver-sanders oliver-sanders merged commit 99fa0f5 into cylc:master Nov 13, 2023
31 of 36 checks passed
@oliver-sanders
Copy link
Member

Ach dammit, I hadn't spotted the failing tests.

@wxtim, could you take a look at:

  • tests/f/events/13-task-event-mail-globalcfg.t
  • tests/f/events/29-task-event-mail-1.t
  • tests/f/events/30-task-event-mail-2.t
  • tests/f/events/09-task-event-mail.t

(now on master, mb)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies infrastructure GH Actions, Codecov etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants