Run Python 3.10 under coverage (#818)

Since the matching code is Python 3.10-specific, we run it under coverage.
This commit is contained in:
Hynek Schlawack 2021-05-18 11:28:21 +02:00 committed by GitHub
parent 8613af97bb
commit 6731eea0ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 7 deletions

View File

@ -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: |

View File

@ -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",

View File

@ -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):

15
tox.ini
View File

@ -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