Uh oh!
There was an error while loading. Please reload this page.
fix: auto-skip real_api-marked tests by default - #328
Merged
Jason Robert (jrob5756) merged 2 commits intoJul 21, 2026
Conversation
Add a pytest_collection_modifyitems hook to tests/conftest.py that skips any @pytest.mark.real_api test unless the caller's -m expression already references real_api (e.g. `-m real_api` to opt in, or CI's exact `-m "not real_api and not performance"`), in which case pytest's own marker-expression filtering is left to decide selection/deselection. Previously nothing deselected real_api tests by default: a plain pytest, `pytest -m "not performance"`, or `make test` would run them, spawning real copilot/claude subprocesses that can collide with (and kill) a live `conductor run --web-bg` session. Adds tests/test_config/test_real_api_marker.py, a pytester-based regression suite that exercises the actual hook (loaded by file path) against a synthetic real_api-marked test, verifying: - default run (no -m) skips it - -m "not performance" skips it (the issue's exact repro) - -m real_api runs it - CI's exact -m "not real_api and not performance" still deselects it - a reverted/no-op hook would NOT skip it (load-bearing check) Verified full suite: 4161 passed, 29 skipped, 29 deselected, 0 failed (previously 1 failed from a real session.create call). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Update tests/conftest.py module docstring to mention the new
pytest_collection_modifyitems hook instead of only "fixtures".
- Use config.getoption("markexpr") instead of the "-m" option-string
alias, and drop the redundant `or ""` fallback (pytest defaults -m to
"" already).
- De-duplicate the issue #326 rationale between the hook's docstring and
the test module's docstring; the test module now points to the hook as
the source of truth.
- Note in test_ci_marker_expression_still_deselects that its -m string
is duplicated in ci.yml/release.yml and should be kept in sync.
- Add test_regex_does_not_match_unrelated_marker_name to directly verify
the \breal_api\b word-boundary regex doesn't false-positive on an
unrelated marker name that merely contains "real_api" as a substring.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>Uh oh!
There was an error while loading. Please reload this page.
Jason Robert (jrob5756)
deleted the
fix/326-real-api-tests-not-deselected
branch
July 21, 2026 18:42
This was referenced Jul 21, 2026
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 freeto 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
Fixes#326.
@pytest.mark.real_apiwas registered inpyproject.tomlbut nothingdeselected it by default — only CI/release workflows hand-filtered with
-m "not real_api and not performance". A plainpytest,pytest -m "not performance", ormake testwould run those tests,spawning real
copilot/claudesubprocesses. That's more than a hygieneissue: it can hard-kill a live
conductor run --web-bgworkflow when runfrom inside it (unhandled
SIGTERM, noworkflow_failedevent, PID fileleft behind).
Changes
tests/conftest.py: add apytest_collection_modifyitemshook thatskips any
real_api-marked item unless the caller's-mexpressionalready references
real_api(word-boundary match) — covering bothexplicit opt-in (
-m real_api) and CI's existing-m "not real_api and not performance", which keep working unchangedsince pytest's own marker-expression evaluation handles those cases.
tests/test_config/test_real_api_marker.py: new pytester-basedregression suite that loads the actual hook by file path (not a copy)
and verifies:
-m) skips the real_api test-m "not performance"skips it (the issue's exact repro)-m real_apiruns it-m "not real_api and not performance"still deselects itthis suite would catch a future regression)
No changes needed to
Makefile/CI/release workflows — their existing-mexpressions are unaffected by the hook.
Validation
make lint/make typecheck— clean (pre-existing unrelatedtywarning in
dialog_evaluator.pyonly).uv run pytest tests/test_config/test_real_api_marker.py -v— 5/5 pass.uv run pytest tests/test_integration/test_copilot_large_write.py tests/test_integration/test_claude_real_api.py tests/test_config/test_ci_infrastructure.py -v(no-m) — allreal_apitests report skipped, proving no subprocess spawn.uv run pytest tests/test_config/test_ci_infrastructure.py -m real_api -v— confirms opt-in still runs them.
uv run pytest -q -m "not performance"—4161 passed, 29 skipped, 29 deselected, 0 failed (previously 1 failed
from a real
session.createcall per the issue repro).🤖 Generated with Copilot CLI
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com