Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python 3.11
- name: Set up Python 3.14
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.14"
- uses: pre-commit/action@v3.0.1
with:
extra_args: --all-files
Expand All @@ -41,6 +41,7 @@ jobs:
- "3.11"
- "3.12"
- "3.13"
- "3.14"
pytest-version:
- ">=8.1.1"

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/codspeed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
workflow_dispatch:

env:
PYTHON_VERSION: "3.12"
PYTHON_VERSION: "3.14"
SHARDS: 4

jobs:
Expand All @@ -20,12 +20,12 @@ jobs:
name: "Run ${{ matrix.mode }} benchmarks (Shard #${{ matrix.shard }})"
runs-on: ${{ matrix.mode == 'instrumentation' && 'ubuntu-24.04' || 'codspeed-macro' }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
submodules: "recursive"
- name: Install required-version defined in uv.toml
uses: astral-sh/setup-uv@v5
- uses: actions/setup-python@v2
uses: astral-sh/setup-uv@v7
- uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install local version of pytest-codspeed
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
with:
submodules: true
- name: Build wheels
uses: pypa/cibuildwheel@v2.22.0
uses: pypa/cibuildwheel@v3.2.1
env:
CIBW_ARCHS: ${{ matrix.platform.arch }}
with:
Expand All @@ -48,7 +48,7 @@ jobs:
version: "0.5.20"
- uses: actions/setup-python@v2
with:
python-version: "3.12"
python-version: "3.14"
- name: Build py3-none-any wheel
env:
PYTEST_CODSPEED_SKIP_EXTENSION_BUILD: "1"
Expand All @@ -70,7 +70,7 @@ jobs:
version: "0.5.20"
- uses: actions/setup-python@v2
with:
python-version: "3.12"
python-version: "3.14"
- name: Build the source dist
run: uv build --sdist --out-dir dist/

Expand All @@ -97,7 +97,7 @@ jobs:
version: "0.5.20"
- uses: actions/setup-python@v2
with:
python-version: "3.12"
python-version: "3.14"

- uses: actions/download-artifact@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repos:
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.3.0
rev: v1.18.2
hooks:
- id: mypy
- repo: https://github.com/astral-sh/ruff-pre-commit
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ classifiers = [
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Software Development :: Testing",
"Topic :: System :: Benchmark",
"Topic :: Utilities",
Expand All @@ -49,7 +50,7 @@ pytest-codspeed = { workspace = true }
[dependency-groups]
dev = [
"pytest-codspeed",
"mypy ~= 1.11.2",
"mypy ~= 1.18.2",
"ruff ~= 0.11.12",
"pytest ~= 7.0",
"pytest-cov ~= 4.0.0",
Expand Down
7 changes: 6 additions & 1 deletion src/pytest_codspeed/instruments/valgrind.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import os
import warnings
from typing import TYPE_CHECKING

Expand Down Expand Up @@ -27,7 +28,11 @@ def __init__(self, config: CodSpeedConfig) -> None:
try:
self.instrument_hooks = InstrumentHooks()
self.instrument_hooks.set_integration("pytest-codspeed", __semver_version__)
except RuntimeError:
except RuntimeError as e:
if os.environ.get("CODSPEED_ENV") is not None:
raise Exception(
"Failed to initialize CPU simulation instrument hooks"
) from e
self.instrument_hooks = None

self.should_measure = self.instrument_hooks is not None
Expand Down
10 changes: 6 additions & 4 deletions src/pytest_codspeed/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from dataclasses import dataclass, field
from pathlib import Path
from time import time
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, cast

import pytest
from _pytest.fixtures import FixtureManager
Expand Down Expand Up @@ -96,7 +96,7 @@ class CodSpeedPlugin:


def get_plugin(config: pytest.Config) -> CodSpeedPlugin:
return config.pluginmanager.get_plugin(PLUGIN_NAME)
return cast("CodSpeedPlugin", config.pluginmanager.get_plugin(PLUGIN_NAME))


@pytest.hookimpl(tryfirst=True)
Expand Down Expand Up @@ -159,13 +159,15 @@ def pytest_plugin_registered(plugin, manager: pytest.PytestPluginManager):
plugin, FixtureManager
):
fixture_manager = plugin
codspeed_plugin: CodSpeedPlugin = manager.get_plugin(PLUGIN_NAME)
codspeed_plugin: CodSpeedPlugin = cast(
"CodSpeedPlugin", manager.get_plugin(PLUGIN_NAME)
)
if codspeed_plugin.is_codspeed_enabled:
codspeed_benchmark_fixtures = plugin.getfixturedefs(
"codspeed_benchmark",
fixture_manager.session.nodeid
if BEFORE_PYTEST_8_1_1
else fixture_manager.session,
else cast("str", fixture_manager.session),
)
assert codspeed_benchmark_fixtures is not None
# Archive the alternative benchmark fixture
Expand Down
Loading