feat: warn when running on an unsupported Python version - #133
feat: warn when running on an unsupported Python version#133not-matthias wants to merge 1 commit into
Conversation
Merging this PR will regress 7 benchmarks
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | WallTime | test_recursive_fibo_20 |
5.3 ms | 5.9 ms | -9.39% |
| ❌ | WallTime | test_noop_lambda_decorated |
1.3 µs | 1.3 µs | -4.87% |
| ❌ | WallTime | test_mmap_operation[409600] |
128.5 µs | 135.1 µs | -4.85% |
| ❌ | Memory | test_multiprocessing_map[100] |
3.2 MB | 3.4 MB | -3.83% |
| ❌ | WallTime | test_generate_sum_of_subsets_soln[nums0-9] |
26.1 µs | 27.1 µs | -3.54% |
| ❌ | WallTime | test_noop_pass_decorated |
658.4 ns | 680.7 ns | -3.27% |
| ❌ | WallTime | test_tcp_connection[1.1.1.1-53] |
948.1 µs | 973.5 µs | -2.6% |
| ⚡ | WallTime | test_multiprocessing_map[100000] |
419.4 ms | 320.6 ms | +30.83% |
| ⚡ | WallTime | test_multiprocessing_map[1000] |
59.2 ms | 51 ms | +16.01% |
| ⚡ | Memory | test_multiprocessing_map[10] |
4.1 MB | 3.6 MB | +13.73% |
| ⚡ | Memory | test_multiprocessing_map[10000] |
3.4 MB | 3.1 MB | +9.28% |
| ⚡ | Memory | test_multiprocessing_map[100000] |
6.2 MB | 5.7 MB | +8.93% |
| ⚡ | WallTime | test_sum_of_squares[sum_of_squares_sum_labmda_power] |
350.4 µs | 325.7 µs | +7.59% |
| ⚡ | Memory | test_multiprocessing_map[1000] |
3.7 MB | 3.5 MB | +5.86% |
| ⚡ | WallTime | test_get_valid_pos[pos0-4] |
2.9 µs | 2.7 µs | +4.98% |
| ⚡ | WallTime | test_sum_of_squares[sum_of_squares_sum_comprehension_power] |
238.5 µs | 230.7 µs | +3.4% |
| ⚡ | WallTime | test_solve_maze[maze0] |
24.8 µs | 24.1 µs | +3.09% |
| ⚡ | WallTime | test_make_highpass |
5.5 µs | 5.4 µs | +2.91% |
| ⚡ | WallTime | test_open_close_fd[100] |
901.6 µs | 876.9 µs | +2.81% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing cod-3400-warn-when-running-pytest-codspeed-with-unsupported-python (4e49265) with master (c7e9981)
Footnotes
-
55 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
e09ec2d to
2345b56
Compare
|
@greptileai review |
Print a warning in the pytest header when the interpreter is outside the version range pytest-codspeed claims to support, so customers upgrading Python are told their measurements run on an untested interpreter instead of getting silent, unvalidated results. On GitHub Actions the warning is emitted as a `::warning` workflow command so it becomes an annotation shown outside the job log; on GitLab CI, which has no annotation mechanism, the line is coloured instead. Mirrors the `warnCi` helper of the codspeed-node counterpart, including the percent-encoding of workflow-command syntax. The bounds mirror `requires-python` and the `Programming Language :: Python` classifiers in pyproject.toml, and the CI matrix. Refs COD-3400
2345b56 to
4e49265
Compare
Greptile SummaryThe PR adds a pytest-header notice when the active interpreter falls outside the supported Python 3.9–3.15 range.
Confidence Score: 5/5The PR appears safe to merge because no blocking failure remains. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| src/pytest_codspeed/plugin.py | Adds supported-version bounds, warning formatting, and inclusion of the warning in pytest's report header. |
| tests/test_pytest_plugin.py | Adds tests for supported and unsupported versions, GitHub Actions annotations, and header integration. |
Reviews (2): Last reviewed commit: "feat: warn when running on an unsupporte..." | Re-trigger Greptile
| if os.environ.get("GITHUB_ACTIONS") == "true": | ||
| title = _escape_workflow_command_property(title) | ||
| return f"::warning title={title}::{_escape_workflow_command_data(message)}" | ||
| return f"\033[93m{message}\033[0m" |
There was a problem hiding this comment.
On an unsupported interpreter outside GitHub Actions, format_ci_warning embeds ANSI sequences even when pytest uses --color=no or writes to redirected output, leaving terminal-control bytes in non-color logs.
Knowledge Base Used: Validation and benchmark fixtures
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/pytest_codspeed/utils.py
Line: 75
Comment:
**ANSI ignores color settings**
On an unsupported interpreter outside GitHub Actions, `format_ci_warning` embeds ANSI sequences even when pytest uses `--color=no` or writes to redirected output, leaving terminal-control bytes in non-color logs.
**Knowledge Base Used:** [Validation and benchmark fixtures](https://app.greptile.com/codspeed/-/custom-context/knowledge-base/codspeedhq/pytest-codspeed/-/docs/validation-and-benchmark-fixtures.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Print a warning in the pytest header when the running interpreter is outside the
Python version range pytest-codspeed claims to support:
Customers upgrading Python currently get silent, unvalidated measurements: nothing
tells them the interpreter they benchmark on was never tested. Surfacing it in the
header means it lands in the CI log right under the existing
codspeed: <version>line, next to the other notices.
The bounds live in
pytest_codspeed.utilsand mirrorrequires-pythonplus theProgramming Language :: Pythonclassifiers inpyproject.tomland the CI matrix.The issue did not specify a list, and the sources disagreed: the classifiers and CI
say 3.15, while the README badge says 3.14 and the docs badge 3.13. The badges are
stale (docs still claimed 3.13 well after 3.14 classifiers shipped), so the bounds
follow the classifiers. Warning on 3.15 would contradict the package's own metadata
and redden the 3.15 CI legs.
test_get_python_version_warning_supportedasserts no warning fires on theinterpreter running the suite, so adding a Python version to the CI matrix without
bumping the constant fails loudly instead of silently warning users.
Not included: the "warning on the Run page" half of the issue is platform-side. The
plugin already ships full interpreter metadata via
get_environment_metadataandcollect_and_write_python_environment, so no extra plumbing is needed here.Refs COD-3400