Add unstable Python 3.12 to CI allowing failures (#1033)

* Add unstable Python 3.12 to CI allowing failures

* 🔧 Add a toxenv for 🐍 Python 3.12

* Account for 3.12 abc error @ test_remain_abstract

Co-authored-by: Hynek Schlawack <hs@ox.cx>
This commit is contained in:
Sviatoslav Sydorenko 2022-12-18 11:46:08 +01:00 committed by GitHub
parent 59a445e584
commit 90f7590abf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 6 deletions

View File

@ -34,9 +34,13 @@ jobs:
- "3.9"
- "3.10"
- "3.11"
- "~3.12.0-0"
- "pypy-3.7"
- "pypy-3.8"
continue-on-error: >-
${{ contains(matrix.python-version, '~') && true || false }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2

View File

@ -13,6 +13,7 @@ from collections.abc import Mapping, Sequence # noqa
PYPY = platform.python_implementation() == "PyPy"
PY310 = sys.version_info[:2] >= (3, 10)
PY_3_12_PLUS = sys.version_info[:2] >= (3, 12)
def just_warn(*args, **kw):

View File

@ -7,7 +7,7 @@ import pytest
import attrs
from attr._compat import PY310
from attr._compat import PY310, PY_3_12_PLUS
@pytest.mark.skipif(not PY310, reason="abc.update_abstractmethods is 3.10+")
@ -50,7 +50,11 @@ class TestUpdateAbstractMethods:
pass
assert inspect.isabstract(StillAbstract)
with pytest.raises(
TypeError, match="class StillAbstract with abstract method foo"
):
expected_exception_message = (
"^Can't instantiate abstract class StillAbstract without an "
"implementation for abstract method 'foo'$"
if PY_3_12_PLUS
else "class StillAbstract with abstract method foo"
)
with pytest.raises(TypeError, match=expected_exception_message):
StillAbstract()

View File

@ -7,11 +7,12 @@ python =
3.9: py39
3.10: py310, mypy
3.11: py311
3.12: py312
pypy-3: pypy3
[tox]
envlist = mypy,pre-commit,py36,py37,py38,py39,py310,py311,pypy3,pyright,manifest,docs,pypi-description,changelog,coverage-report
envlist = mypy,pre-commit,py36,py37,py38,py39,py310,py311,py312,pypy3,pyright,manifest,docs,pypi-description,changelog,coverage-report
isolated_build = True
@ -42,7 +43,7 @@ setenv =
commands = {[testenv:py36]commands}
[testenv:py311]
[testenv:py31{1,2}]
extras = cov
# Python 3.6+ has a number of compile-time warnings on invalid string escapes.
# PYTHONWARNINGS=d and --no-compile below make them visible during the Tox run.