Repository navigation
ci: only install pytest-freethreaded for the free-threaded test run - #548
Merged
Merged
Conversation
pytest-freethreaded hooks every test as soon as it is installed and runs it 200 times on 10 threads, whether or not the GIL is disabled. It was a default dev dependency on Python >= 3.13, so the 3.13 and 3.14 CI jobs and every local run on 3.13+ looped each test, and a BaseException such as a pyo3 PanicException or pytest's own Failed/Skipped could hang the run instead of failing it. Move it into a `freethreaded` dependency group and only request that group in the 3.14t `--require-gil-disabled` step. Closes kylebarron#528
Contributor
Author
|
CI failure on the Python 3.13 job looks unrelated to this PR: mkdocs/mkdocstrings cannot load DuckDB's intersphinx inventory ( (AI-assisted reply.) |
Contributor
Author
|
CI note: pytest is green; the red Python job is |
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.
Closes #528.
pytest-freethreadedtakes overpytest_runtest_callas soon as it is installed and runs each test 200 times on 10 threads, whether or not the GIL is disabled. Because it was a default dev dependency on Python >= 3.13, the 3.13 and 3.14 jobs (and any local run on 3.13+) looped every test, and aBaseException(pyo3PanicException, or pytest's ownFailed/Skipped) could hang the run, as described in the issue.This takes option 2 from the issue:
pytest-freethreadedout of the default dev dependencies into a newfreethreadeddependency group (keeping thepython_version >= '3.13'marker)uv run --python 3.14t --group freethreaded pytest tests --require-gil-disableduv.lock(only the group entries change; locked with uv 0.12 so the lockfile stays atrevision = 3, anduv lock --checkwith uv 0.8.24, the version CI pins, is clean)I went with the dependency group instead of
addopts = --threads 1 --iterations 1because those flags would be rejected on 3.11/3.12, where the plugin isn't installed.Local developers who want the stress run can use
uv run --group freethreaded pytest tests --require-gil-disabledon a free-threaded interpreter. Sinceuv rundoesn't uninstall extra packages, an existing local.venvkeeps the plugin untiluv sync(oruv pip uninstall pytest-freethreaded).Testing
maturin dev: the plugin is no longer installed by default;pytest testsgives 207 passed in ~2 s. A throwaway test that appends a line to a file per call ran 1 time by default and 201 times with--group freethreaded.uv run --python 3.14t --group freethreaded pytest tests --require-gil-disabledgives 207 passed (plugin active).AI disclosure: I made this change with help from an AI coding assistant (Grok Bot), which wrote the edits and the PR text. I reviewed the diff and ran the checks above locally.