Python(feat): pytest plugin improvements#567
Merged
alexluck-sift merged 14 commits intoMay 19, 2026
Merged
Conversation
Contributor
|
Python docs preview: https://sift-stack.github.io/sift/python/pr-567/ Deployed from |
ian-sift
requested changes
May 18, 2026
ian-sift
approved these changes
May 18, 2026
ian-sift
approved these changes
May 19, 2026
0bb2d5a
into
al/python/feat/pytest-dev-branch
18 checks passed
alexluck-sift
added a commit
that referenced
this pull request
May 19, 2026
…t-offline and --sift-disabled Replaces the per-fixture connection gate from #567 (which made `report_context` / `step` / `module_substep` yield None on a failed ping, breaking user code that calls `step.measure(...)`) with two explicit modes: * `--sift-offline` writes every create/update to the JSONL log file for later replay via `import-test-result-log`. The session-start ping is skipped and the replay subprocess is not spawned at session end. Combining with `--sift-log-file=none` is rejected as a usage error since the log file is the sole sink. * `--sift-disabled` skips Sift entirely. Autouse fixtures yield stub objects (`_NoopStep`, `_NoopReportContext`) that share the bounds helpers from `bounds`, so `step.measure(...)` still returns real pass/fail booleans without any Sift configuration. Also honored via the `SIFT_DISABLED` env var. The two modes are mutually exclusive. Online mode now fail-fasts at session start: a failed ping aborts the session with `pytest.UsageError` naming both flags as escape hatches, instead of letting fixtures silently no-op. Preserves #567's marker system (`sift_include` / `sift_exclude` + `sift_test_results_autouse` ini key), lazy `report_context`, per-module gate, URI ini fallbacks, and the `_Option` CLI+ini plumbing. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
sift_client.pytest_plugin(was buried atutil/test_results/pytest_util) so users wire it in with a singlepytest_plugins = ["sift_client.pytest_plugin"].sift_clientfixture that readsSIFT_*env vars withsift_grpc_uri/sift_rest_uriini fallback, so per-project config can live inpyproject.toml._tests/pytest_plugin/so each follow-up PR drops a file rather than appending to a monolith.sift_include/sift_excludemarkers and asift_test_results_autouseini key so projects scope which tests produce Sift reports. Closest marker wins, defaults to the ini value. Bulk-apply per directory withpytest_collection_modifyitemsin a conftest.report_contextcreated lazily. Mixed unit/integration suites can share onepytestinvocation without unit tests paying the backend round-trip.