diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1ee2804..f8ebbf2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,15 +30,15 @@ jobs: matrix: config: - headless - - pytest-benchmark + - pytest-benchmark-4 + - pytest-benchmark-5 - valgrind python-version: - - "3.8" - "3.9" - "3.10" - "3.11" - "3.12" - - "3.13.0-rc.1" + - "3.13" pytest-version: - ">=8.1.1" @@ -52,10 +52,15 @@ jobs: name: Install valgrind run: sudo apt-get install valgrind -y - name: Install dependencies with pytest${{ matrix.pytest-version }} - run: pip install .[dev,compat,build] "pytest${{ matrix.pytest-version }}" - - if: matrix.config != 'pytest-benchmark' - name: Uninstall pytest-benchmark - run: pip uninstall -y pytest-benchmark + run: | + pip install .[dev,compat,build] "pytest${{ matrix.pytest-version }}" + pip uninstall -y pytest-benchmark + - if: matrix.config == 'pytest-benchmark-4' + name: Install pytest-benchmark 4.0.0 + run: pip install pytest-benchmark~=4.0.0 + - if: matrix.config == 'pytest-benchmark-5' + name: Install pytest-benchmark 5.0.0 + run: pip install pytest-benchmark~=5.0.0 - name: Run tests run: pytest -vs diff --git a/.github/workflows/codspeed.yml b/.github/workflows/codspeed.yml index c1b35d3..3cddc55 100644 --- a/.github/workflows/codspeed.yml +++ b/.github/workflows/codspeed.yml @@ -1,4 +1,4 @@ -name: benchmarks +name: CodSpeed on: push: branches: [master] @@ -8,7 +8,8 @@ on: jobs: benchmarks: - runs-on: ubuntu-latest + name: Run benchmarks + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bc0e19a..edcf09b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,12 +14,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: actions/setup-python@v2 with: - python-version: "3.11" + python-version: "3.11" - name: Install dependencies run: pip install hatch diff --git a/README.md b/README.md index 8a0006d..2aa5264 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![CI](https://github.com/CodSpeedHQ/pytest-codspeed/actions/workflows/ci.yml/badge.svg)](https://github.com/CodSpeedHQ/pytest-codspeed/actions/workflows/ci.yml) [![PyPi Version](https://img.shields.io/pypi/v/pytest-codspeed?color=%2334D058&label=pypi)](https://pypi.org/project/pytest-codspeed) -![Python Version](https://img.shields.io/badge/python-3.8%20|%203.9%20|%203.10%20|%203.11%20|%203.12%20|%203.13-informational.svg) +![Python Version](https://img.shields.io/badge/python-3.9%20|%203.10%20|%203.11%20|%203.12%20|%203.13-informational.svg) [![Discord](https://img.shields.io/badge/chat%20on-discord-7289da.svg)](https://discord.com/invite/MxpaCfKSqF) [![CodSpeed Badge](https://img.shields.io/endpoint?url=https://codspeed.io/badge.json)](https://codspeed.io/CodSpeedHQ/pytest-codspeed) @@ -13,7 +13,7 @@ Pytest plugin to create CodSpeed benchmarks ## Requirements -**Python**: 3.8 and later +**Python**: 3.9 and later **pytest**: any recent version @@ -88,7 +88,7 @@ You can use the [CodSpeedHQ/action](https://github.com/CodSpeedHQ/action) to run Example workflow: ```yaml -name: benchmarks +name: CodSpeed on: push: @@ -98,6 +98,7 @@ on: jobs: benchmarks: + name: Run benchmarks runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/pyproject.toml b/pyproject.toml index 85e0144..93d8d4f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,7 @@ dynamic = ["version"] description = "Pytest plugin to create CodSpeed benchmarks" readme = "README.md" license = { file = "LICENSE" } -requires-python = ">=3.8" +requires-python = ">=3.9" authors = [{ name = "Arthur Pastel", email = "arthur@codspeed.io" }] keywords = ["codspeed", "benchmark", "performance", "pytest"] classifiers = [ @@ -23,7 +23,6 @@ classifiers = [ "Intended Audience :: Information Technology", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -49,7 +48,7 @@ dependencies = [ build = ["semver>=3.0.2"] lint = ["mypy ~= 1.11.2", "ruff ~= 0.6.5"] compat = [ - "pytest-benchmark ~= 4.0.0", + "pytest-benchmark ~= 5.0.0", "pytest-xdist ~= 3.6.1", # "pytest-speed>=0.3.5", ] @@ -65,7 +64,7 @@ features = ["lint", "test", "compat"] features = ["test"] [[tool.hatch.envs.test.matrix]] -python = ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] +python = ["3.9", "3.10", "3.11", "3.12", "3.13"] features = ["compat", "test"] [tool.hatch.version] diff --git a/src/pytest_codspeed/__init__.py b/src/pytest_codspeed/__init__.py index 849b7be..4ebf86a 100644 --- a/src/pytest_codspeed/__init__.py +++ b/src/pytest_codspeed/__init__.py @@ -1,6 +1,6 @@ -__version__ = "3.0.0b4" +__version__ = "3.0.0" # We also have the semver version since __version__ is not semver compliant -__semver_version__ = "3.0.0-b4" +__semver_version__ = "3.0.0" from .plugin import BenchmarkFixture diff --git a/src/pytest_codspeed/plugin.py b/src/pytest_codspeed/plugin.py index f86e47d..881b27d 100644 --- a/src/pytest_codspeed/plugin.py +++ b/src/pytest_codspeed/plugin.py @@ -320,6 +320,18 @@ def pytest_sessionfinish(session: pytest.Session, exitstatus): class BenchmarkFixture: """The fixture that can be used to benchmark a function.""" + @property # type: ignore + def __class__(self): + # Bypass the pytest-benchmark fixture class check + # https://github.com/ionelmc/pytest-benchmark/commit/d6511e3474931feb4e862948128e0c389acfceec + if IS_PYTEST_BENCHMARK_INSTALLED: + from pytest_benchmark.fixture import ( + BenchmarkFixture as PytestBenchmarkFixture, + ) + + return PytestBenchmarkFixture + return BenchmarkFixture + def __init__(self, request: pytest.FixtureRequest): self.extra_info: dict = {} diff --git a/src/pytest_codspeed/py.typed b/src/pytest_codspeed/py.typed new file mode 100644 index 0000000..e69de29