From afa8019370822b396b60e8b23fa8f3e92bf1b5ff Mon Sep 17 00:00:00 2001 From: Kevin Van Brunt Date: Thu, 12 Sep 2024 14:56:45 -0400 Subject: [PATCH] Updating unit tests to support Python 3.12. --- .github/workflows/ci.yml | 2 +- .github/workflows/doc.yml | 2 +- .github/workflows/format.yml | 2 +- .github/workflows/lint.yml | 2 +- .github/workflows/mypy.yml | 2 +- CHANGELOG.md | 1 + noxfile.py | 4 ++-- plugins/ext_test/build-pyenvs.sh | 2 +- plugins/ext_test/noxfile.py | 2 +- plugins/ext_test/setup.py | 1 + plugins/template/README.md | 6 +++--- plugins/template/build-pyenvs.sh | 2 +- plugins/template/noxfile.py | 2 +- plugins/template/setup.py | 1 + setup.py | 1 + 15 files changed, 18 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0e16e694..27313e8c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-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.12"] fail-fast: false runs-on: ${{ matrix.os }} steps: diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index 77f18218..9605605f 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: ["3.11"] + python-version: ["3.12"] fail-fast: false runs-on: ${{ matrix.os }} steps: diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 3a8d2ab7..f168f598 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: ["3.11"] + python-version: ["3.12"] fail-fast: false runs-on: ${{ matrix.os }} steps: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 9eb8ebdc..f7a97227 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: ["3.11"] + python-version: ["3.12"] fail-fast: false runs-on: ${{ matrix.os }} steps: diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index c5f2aca6..727ed43d 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: ["3.11"] + python-version: ["3.12"] fail-fast: false runs-on: ${{ matrix.os }} steps: diff --git a/CHANGELOG.md b/CHANGELOG.md index ef42ed89..ef91cb0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ * Removed dependency on `attrs` and replaced with [dataclasses](https://docs.python.org/3/library/dataclasses.html) * add `allow_clipboard` initialization parameter and attribute to disable ability to add output to the operating system clipboard + * Updated unit tests to be Python 3.12 compliant. * Deletions (potentially breaking changes) * Removed `apply_style` from `Cmd.pwarning()`. diff --git a/noxfile.py b/noxfile.py index f7a705fb..02d0933f 100644 --- a/noxfile.py +++ b/noxfile.py @@ -17,7 +17,7 @@ def docs(session): ) -@nox.session(python=['3.7', '3.8', '3.9', '3.10', '3.11']) +@nox.session(python=['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']) @nox.parametrize('plugin', [None, 'ext_test', 'template', 'coverage']) def tests(session, plugin): if plugin is None: @@ -41,7 +41,7 @@ def tests(session, plugin): ) -@nox.session(python=['3.8', '3.9', '3.10', '3.11']) +@nox.session(python=['3.8', '3.9', '3.10', '3.11', '3.12']) @nox.parametrize('step', ['mypy', 'flake8']) def validate(session, step): session.install('invoke', './[validate]') diff --git a/plugins/ext_test/build-pyenvs.sh b/plugins/ext_test/build-pyenvs.sh index 572db568..3b2c1811 100644 --- a/plugins/ext_test/build-pyenvs.sh +++ b/plugins/ext_test/build-pyenvs.sh @@ -23,7 +23,7 @@ # virtualenvs will be added to '.python-version'. Feel free to modify # this list, but note that this script intentionally won't install # dev, rc, or beta python releases -declare -a pythons=("3.7" "3.8" "3.9", "3.10", "3.11") +declare -a pythons=("3.7" "3.8" "3.9", "3.10", "3.11", "3.12") # function to find the latest patch of a minor version of python function find_latest_version { diff --git a/plugins/ext_test/noxfile.py b/plugins/ext_test/noxfile.py index 9872e193..3c10ab63 100644 --- a/plugins/ext_test/noxfile.py +++ b/plugins/ext_test/noxfile.py @@ -1,7 +1,7 @@ import nox -@nox.session(python=['3.7', '3.8', '3.9', '3.10', '3.11']) +@nox.session(python=['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']) def tests(session): session.install('invoke', './[test]') session.run('invoke', 'pytest', '--junit', '--no-pty') diff --git a/plugins/ext_test/setup.py b/plugins/ext_test/setup.py index 644d2677..987c6738 100644 --- a/plugins/ext_test/setup.py +++ b/plugins/ext_test/setup.py @@ -48,6 +48,7 @@ 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', ], # dependencies for development and testing # $ pip install -e .[dev] diff --git a/plugins/template/README.md b/plugins/template/README.md index f7f6d057..87eae8d5 100644 --- a/plugins/template/README.md +++ b/plugins/template/README.md @@ -210,7 +210,7 @@ tiered testing strategy to accomplish this objective. - [pytest](https://pytest.org) runs the unit tests - [nox](https://nox.thea.codes/en/stable/) runs the unit tests on multiple versions of python -- [GitHub Actions](https://github.com/features/actions) runs the tests on the various +- [GitHub Actions](https://github.com/features/actions) runs the tests on the various supported platforms This plugin template is set up to use the same strategy. @@ -291,8 +291,8 @@ unit tests found in the `tests` directory. ### Use nox to run unit tests in multiple versions of python The included `noxfile.py` is setup to run the unit tests in python 3.7, 3.8, -3.9, 3.10, and 3.11 You can run your unit tests in all of these versions of -python by: +3.9, 3.10, 3.11, and 3.12 You can run your unit tests in all of these versions +of python by: ``` $ nox ``` diff --git a/plugins/template/build-pyenvs.sh b/plugins/template/build-pyenvs.sh index f4084494..044ba6bc 100644 --- a/plugins/template/build-pyenvs.sh +++ b/plugins/template/build-pyenvs.sh @@ -23,7 +23,7 @@ # virtualenvs will be added to '.python-version'. Feel free to modify # this list, but note that this script intentionally won't install # dev, rc, or beta python releases -declare -a pythons=("3.7" "3.8" "3.9" "3.10" "3.11") +declare -a pythons=("3.7" "3.8" "3.9" "3.10" "3.11", "3.12") # function to find the latest patch of a minor version of python function find_latest_version { diff --git a/plugins/template/noxfile.py b/plugins/template/noxfile.py index 9872e193..3c10ab63 100644 --- a/plugins/template/noxfile.py +++ b/plugins/template/noxfile.py @@ -1,7 +1,7 @@ import nox -@nox.session(python=['3.7', '3.8', '3.9', '3.10', '3.11']) +@nox.session(python=['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']) def tests(session): session.install('invoke', './[test]') session.run('invoke', 'pytest', '--junit', '--no-pty') diff --git a/plugins/template/setup.py b/plugins/template/setup.py index 47cc72c2..9c1fc73e 100644 --- a/plugins/template/setup.py +++ b/plugins/template/setup.py @@ -39,6 +39,7 @@ 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', ], # dependencies for development and testing # $ pip install -e .[dev] diff --git a/setup.py b/setup.py index dae53695..43b94a4b 100755 --- a/setup.py +++ b/setup.py @@ -33,6 +33,7 @@ Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 +Programming Language :: Python :: 3.12 Programming Language :: Python :: Implementation :: CPython Topic :: Software Development :: Libraries :: Python Modules """.splitlines(),