tests: Test on Python 3.12 (locally and on CI) #255
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds Python 3.12 tox environments and a CI test job. This PR should probably be updated before being merged, so that all checks pass. There is more than one way this could be done, as detailed at the very end of this PR description.
"Experimental" status:
continue-on-error
,allow-prereleases
The 3.11 CI job had been marked experimental. This marks that non-experimental (like the preceding Python versions' jobs) and marks the 3.12 CI job experimental, with two effects:
experimental
is used as the value ofcontinue-on-error
, if a 3.12 job fails, the workflow as a whole will still fail, but other jobs generated by the CI test matrix will not be automatically canceled.experimental
as the value ofallow-prereleases
forsetup-python
, to allow the Python 3.12 release candidate to be used. At some point after the stable release of Python 3.12.0, that should be removed (or, equivalently, changed to the literal valuefalse
), even ifcontinue-on-error
is kept astrue
for longer.Handling
setuptools
omission andpkg_resources
deprecationFor testing purposes, the first commit (41f3d29) also temporarily adds
setuptools
as an explicit test dependency on 3.12, to support thepkg_resources
import inconftest.py
. But I recommend fixing that issue differently, by migrating frompkg_resources
toimportlib.resources
instead, which I've submitted a patch for in #252. The second commit (94a22de) removes the explicit test dependency forsetuptools
, causing failure.I recommend against merging this pull request until the tests are passing again. I've made the PR this way to allow the CI results to be inspected both for passing and failing 3.12 tests. But a more important reason is that I don't want to dictate how the
pkg_resources
problem is solved:The approach I recommend is to merge tests: Migrate from pkg_resources to importlib.resources #252. Then this PR can be updated by merging
master
into it. That would eliminate the deprecated use ofpkg_resources
.(If tests: Test on multiple operating systems #251 is to be accepted, then it may make sense to merge that first, too, so that when this PR is updated it also gets 3.12 jobs on all three operating systems. Because of 3.12's current status as a prerelease, I believe platform-specific problems are more likely than usual.)
An alternative approach could be to drop or revert the second commit from this PR, keeping the explicit
setuptools
test dependency so the deprecatedpkg_resources
import can be retained. I would only suggest doing this if you have decided to decline or defer tests: Migrate from pkg_resources to importlib.resources #252.