diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml index f74d6d6..993932a 100644 --- a/.github/workflows/github-actions.yml +++ b/.github/workflows/github-actions.yml @@ -595,6 +595,150 @@ jobs: python_arch: 'x64' tox_env: 'py310-pytest72-xdist-nocov' os: 'macos-latest' + - name: 'py311-pytest71-nodist-cover (ubuntu)' + python: '3.11' + toxpython: 'python3.11' + python_arch: 'x64' + tox_env: 'py311-pytest71-nodist-cover,codecov' + os: 'ubuntu-latest' + - name: 'py311-pytest71-nodist-cover (windows)' + python: '3.11' + toxpython: 'python3.11' + python_arch: 'x64' + tox_env: 'py311-pytest71-nodist-cover,codecov' + os: 'windows-latest' + - name: 'py311-pytest71-nodist-cover (macos)' + python: '3.11' + toxpython: 'python3.11' + python_arch: 'x64' + tox_env: 'py311-pytest71-nodist-cover,codecov' + os: 'macos-latest' + - name: 'py311-pytest71-nodist-nocov (ubuntu)' + python: '3.11' + toxpython: 'python3.11' + python_arch: 'x64' + tox_env: 'py311-pytest71-nodist-nocov' + os: 'ubuntu-latest' + - name: 'py311-pytest71-nodist-nocov (windows)' + python: '3.11' + toxpython: 'python3.11' + python_arch: 'x64' + tox_env: 'py311-pytest71-nodist-nocov' + os: 'windows-latest' + - name: 'py311-pytest71-nodist-nocov (macos)' + python: '3.11' + toxpython: 'python3.11' + python_arch: 'x64' + tox_env: 'py311-pytest71-nodist-nocov' + os: 'macos-latest' + - name: 'py311-pytest71-xdist-cover (ubuntu)' + python: '3.11' + toxpython: 'python3.11' + python_arch: 'x64' + tox_env: 'py311-pytest71-xdist-cover,codecov' + os: 'ubuntu-latest' + - name: 'py311-pytest71-xdist-cover (windows)' + python: '3.11' + toxpython: 'python3.11' + python_arch: 'x64' + tox_env: 'py311-pytest71-xdist-cover,codecov' + os: 'windows-latest' + - name: 'py311-pytest71-xdist-cover (macos)' + python: '3.11' + toxpython: 'python3.11' + python_arch: 'x64' + tox_env: 'py311-pytest71-xdist-cover,codecov' + os: 'macos-latest' + - name: 'py311-pytest71-xdist-nocov (ubuntu)' + python: '3.11' + toxpython: 'python3.11' + python_arch: 'x64' + tox_env: 'py311-pytest71-xdist-nocov' + os: 'ubuntu-latest' + - name: 'py311-pytest71-xdist-nocov (windows)' + python: '3.11' + toxpython: 'python3.11' + python_arch: 'x64' + tox_env: 'py311-pytest71-xdist-nocov' + os: 'windows-latest' + - name: 'py311-pytest71-xdist-nocov (macos)' + python: '3.11' + toxpython: 'python3.11' + python_arch: 'x64' + tox_env: 'py311-pytest71-xdist-nocov' + os: 'macos-latest' + - name: 'py311-pytest72-nodist-cover (ubuntu)' + python: '3.11' + toxpython: 'python3.11' + python_arch: 'x64' + tox_env: 'py311-pytest72-nodist-cover,codecov' + os: 'ubuntu-latest' + - name: 'py311-pytest72-nodist-cover (windows)' + python: '3.11' + toxpython: 'python3.11' + python_arch: 'x64' + tox_env: 'py311-pytest72-nodist-cover,codecov' + os: 'windows-latest' + - name: 'py311-pytest72-nodist-cover (macos)' + python: '3.11' + toxpython: 'python3.11' + python_arch: 'x64' + tox_env: 'py311-pytest72-nodist-cover,codecov' + os: 'macos-latest' + - name: 'py311-pytest72-nodist-nocov (ubuntu)' + python: '3.11' + toxpython: 'python3.11' + python_arch: 'x64' + tox_env: 'py311-pytest72-nodist-nocov' + os: 'ubuntu-latest' + - name: 'py311-pytest72-nodist-nocov (windows)' + python: '3.11' + toxpython: 'python3.11' + python_arch: 'x64' + tox_env: 'py311-pytest72-nodist-nocov' + os: 'windows-latest' + - name: 'py311-pytest72-nodist-nocov (macos)' + python: '3.11' + toxpython: 'python3.11' + python_arch: 'x64' + tox_env: 'py311-pytest72-nodist-nocov' + os: 'macos-latest' + - name: 'py311-pytest72-xdist-cover (ubuntu)' + python: '3.11' + toxpython: 'python3.11' + python_arch: 'x64' + tox_env: 'py311-pytest72-xdist-cover,codecov' + os: 'ubuntu-latest' + - name: 'py311-pytest72-xdist-cover (windows)' + python: '3.11' + toxpython: 'python3.11' + python_arch: 'x64' + tox_env: 'py311-pytest72-xdist-cover,codecov' + os: 'windows-latest' + - name: 'py311-pytest72-xdist-cover (macos)' + python: '3.11' + toxpython: 'python3.11' + python_arch: 'x64' + tox_env: 'py311-pytest72-xdist-cover,codecov' + os: 'macos-latest' + - name: 'py311-pytest72-xdist-nocov (ubuntu)' + python: '3.11' + toxpython: 'python3.11' + python_arch: 'x64' + tox_env: 'py311-pytest72-xdist-nocov' + os: 'ubuntu-latest' + - name: 'py311-pytest72-xdist-nocov (windows)' + python: '3.11' + toxpython: 'python3.11' + python_arch: 'x64' + tox_env: 'py311-pytest72-xdist-nocov' + os: 'windows-latest' + - name: 'py311-pytest72-xdist-nocov (macos)' + python: '3.11' + toxpython: 'python3.11' + python_arch: 'x64' + tox_env: 'py311-pytest72-xdist-nocov' + os: 'macos-latest' - name: 'pypy37-pytest71-nodist-cover (ubuntu)' python: 'pypy-3.7' toxpython: 'pypy3.7' diff --git a/CHANGELOG.rst b/CHANGELOG.rst index bb93b23..151d3a2 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,11 @@ Changelog ========= +Unreleased +---------- + +* Added Python 3.11 support. + 4.0.0 (2022-10-26) ------------------ diff --git a/setup.py b/setup.py index 58fb12a..3d7c315 100755 --- a/setup.py +++ b/setup.py @@ -51,6 +51,7 @@ def read(*names, **kwargs): 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', 'Topic :: Software Development :: Testing', diff --git a/src/pytest_benchmark/compat.py b/src/pytest_benchmark/compat.py index 63d01bd..9afecf2 100644 --- a/src/pytest_benchmark/compat.py +++ b/src/pytest_benchmark/compat.py @@ -1,3 +1,4 @@ import sys PY38 = sys.version_info[0] == 3 and sys.version_info[1] >= 8 +PY311 = sys.version_info[0] == 3 and sys.version_info[1] >= 11 diff --git a/src/pytest_benchmark/utils.py b/src/pytest_benchmark/utils.py index c80352a..e28c04e 100644 --- a/src/pytest_benchmark/utils.py +++ b/src/pytest_benchmark/utils.py @@ -26,7 +26,7 @@ import genericpath -from .compat import PY38 +from .compat import PY38, PY311 # This is here (in the utils module) because it might be used by # various other modules. @@ -521,6 +521,10 @@ def clonefunc(f): co.co_firstlineno, co.co_lnotab, co.co_freevars, co.co_cellvars] if PY38: args.insert(1, co.co_posonlyargcount) + + if PY311: + args.insert(12, co.co_qualname) + args.insert(15, co.co_exceptiontable) co2 = types.CodeType(*args) # # then, we clone the function itself, using the new co2 diff --git a/tests/test_benchmark.py b/tests/test_benchmark.py index 280ce24..964787f 100644 --- a/tests/test_benchmark.py +++ b/tests/test_benchmark.py @@ -952,7 +952,6 @@ def result(): " def test_bad(benchmark):", "? @benchmark", - "? def result():", "test_abort_broken.py:*", "_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _*", diff --git a/tox.ini b/tox.ini index 08772c8..55d20cf 100644 --- a/tox.ini +++ b/tox.ini @@ -14,7 +14,7 @@ envlist = clean, check, docs, - {py37,py38,py39,py310,pypy37,pypy38,pypy39}-{pytest71,pytest72}-{nodist,xdist}-{cover,nocov}, + {py37,py38,py39,py310,py311,pypy37,pypy38,pypy39}-{pytest71,pytest72}-{nodist,xdist}-{cover,nocov}, report ignore_basepython_conflict = true @@ -27,6 +27,7 @@ basepython = py38: {env:TOXPYTHON:python3.8} py39: {env:TOXPYTHON:python3.9} py310: {env:TOXPYTHON:python3.10} + py311: {env:TOXPYTHON:python3.11} {bootstrap,clean,check,report,docs,codecov,coveralls}: {env:TOXPYTHON:python3} setenv = PYTHONPATH={toxinidir}/tests