diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bf4ea077..a33efec2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,12 +13,12 @@ jobs: name: "Python ${{ matrix.python-version }}" runs-on: "ubuntu-latest" env: - USING_COVERAGE: "2.7,3.7,3.8" + USING_COVERAGE: "2.7,3.7,3.8,3.10.0-beta - 3.10" strategy: fail-fast: false matrix: - python-version: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10.0-alpha - 3.10", "pypy2", "pypy3"] + python-version: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10.0-beta - 3.10", "pypy2", "pypy3"] steps: - uses: "actions/checkout@v2" @@ -40,7 +40,7 @@ jobs: # parsing errors in older versions for modern code. - uses: "actions/setup-python@v2" with: - python-version: "3.9" + python-version: "3.10.0-beta - 3.10" - name: "Combine coverage" run: | diff --git a/conftest.py b/conftest.py index 85659a8a..79806cb1 100644 --- a/conftest.py +++ b/conftest.py @@ -4,6 +4,8 @@ import sys from hypothesis import HealthCheck, settings +from attr._compat import PY310 + def pytest_configure(config): # HealthCheck.too_slow causes more trouble than good -- especially in CIs. @@ -23,9 +25,9 @@ if sys.version_info[:2] < (3, 6): "tests/test_next_gen.py", ] ) -if sys.version_info[:2] < (3, 10): +if not PY310: collect_ignore.extend(["tests/test_pattern_matching.py"]) -if sys.version_info[:2] >= (3, 10): +if PY310: collect_ignore.extend( [ "tests/test_mypy.yml", diff --git a/src/attr/_compat.py b/src/attr/_compat.py index 6939f338..c218e245 100644 --- a/src/attr/_compat.py +++ b/src/attr/_compat.py @@ -8,6 +8,7 @@ import warnings PY2 = sys.version_info[0] == 2 PYPY = platform.python_implementation() == "PyPy" +PY310 = sys.version_info[:2] >= (3, 10) if PYPY or sys.version_info[:2] >= (3, 6): diff --git a/tox.ini b/tox.ini index d796d038..f134364c 100644 --- a/tox.ini +++ b/tox.ini @@ -61,10 +61,21 @@ extras = {env:TOX_AP_TEST_EXTRAS:tests} commands = coverage run -m pytest {posargs} +[testenv:py310] +# 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. +basepython = python3.10 +install_command = pip install --no-compile {opts} {packages} +setenv = + PYTHONWARNINGS=d +extras = {env:TOX_AP_TEST_EXTRAS:tests} +commands = coverage run -m pytest {posargs} + + [testenv:coverage-report] -basepython = python3.7 +basepython = python3.10 skip_install = true -deps = coverage[toml]>=5.0.2 +deps = coverage[toml]>=5.4 commands = coverage combine coverage report