Repository navigation
[oss] Add GitHub Actions CI for pytest on Python 3.10–3.12 - #203
Merged
Merged
Conversation
- Add .github/workflows/tests.yml (push + pull_request, pip cache, 10 min timeout) - Add [tool.pytest.ini_options] (testpaths, pythonpath) so tests that import scripts/ work regardless of how pytest is launched - Anchor test_public_suite_pairs dataset path to the repo root instead of cwd - Add tests badge under README title Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017Fy3BbvTht2E5AAszd968q
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017Fy3BbvTht2E5AAszd968q
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
.github/workflows/tests.yml(new): runs onpushandpull_requestonubuntu-latest, with a matrix of Python 3.10, 3.11 and 3.12 (fail-fast: false). It caches pip throughactions/setup-python(cache key based onpyproject.toml), has a 10-minute job timeout andpermissions: contents: read. The steps arepython -m pip install -e . pytestand thenpython -m pytest -q.pyproject.toml: adds[tool.pytest.ini_options]withtestpaths = ["tests"]andpythonpath = ["."].tests/test_protocol.py:test_public_suite_pairsreaddatasets/public/original.jsonlrelative to the current directory. It now builds that path fromPath(__file__).resolve().parents[1]. Only the test's path changed; the library and the dataset are untouched.README.md: a tests badge line directly under the title.Diff: 4 files, +34 / −1.
Tests that depended on the local environment (fixed in tests/config, not library code)
test_public_suite_pairsonly passed when pytest ran from the repo root. Fixed by building the path from the test file's location.tests/test_combinations.pyrunsfrom scripts.analyze_combinations import .... This only works withpython -m pytestfrom the repo root, because that puts the current directory onsys.path. Launched any other way, collection fails withModuleNotFoundError: No module named 'scripts'.pythonpath = ["."]fixes this without moving any scripts.I found no flaky tests: 3 repeated runs in a row all passed with identical results.
asyncio setting
I did not add
asyncio_default_fixture_loop_scope. ThePytestDeprecationWarningdoesn't appear because pytest-asyncio isn't a dependency or installed. Also,-W error::DeprecationWarningruns pass cleanly on 3.10–3.12. Setting an option for a plugin that isn't installed would itself trigger a "Unknown config option" warning.How I verified it
Before (main @ b6b8fff, Python 3.13,
python -m pytest -q):Before, run from a different directory (
python -m pytest -q /home/user/jevbench/tests):After, in a clean uv venv per version (
pip install -e . pytest, thenpython -m pytest -q):The workflow YAML loads with
yaml.safe_load.Open doubts
pytestcommand in the sandbox picked up a different interpreter that doesn't have the package installed. That is a local setup issue, so CI usespython -m pytestas specified.actions/workflows/tests.ymlon the default branch, so it shows "no status" until this PR is merged.🤖 Generated with Claude Code
https://claude.ai/code/session_017Fy3BbvTht2E5AAszd968q
Generated by Claude Code