Repository navigation
Description
Problem or Motivation
Part of #1333, item 1 of its Fit note: "Core tests on edge fakes". The tests of src/devops_cli/core/process.py still reach into private state of the runner, and the JSON runner tests patch the runner function itself.
Counts on origin/main (5bc50d0), read again because the tree has moved since #1333 was written:
tests/core/test_consolidation_process_json.pypatchesdevops_cli.core.process.run_subprocess6 times.tests/core/test_subprocess_env_boundary.pyassigns the privateprocess._github_token5 times, and reads and assigns the privateprocess._github_lookup_failure1 time.- The other 14 files that test(cli): Use edge fakes and real git; drop test rebind hooks #1333 names for
corehold norun_subprocessor_github_tokenpatch any more. Earlier items removed them, and the filestest_command_decorator.py,test_consolidation_cli_errors.pyandtest_process_pipeline.pyno longer exist.
The process_fake fixture and the pinned GitHub identity (pin_github_session, reset_github_token) already exist. The tests do not use them.
Proposed Solution & Architectural Design
test_consolidation_process_json.pyanswers the child throughprocess_fake. It patches nodevops_cliname.test_subprocess_env_boundary.pystarts from the identity that the floor pins, or fromreset_github_token()when a test needs no identity. It assigns no private name. A test that needs a token reads the one thatpin_github_sessionyields.- The test of the lookup retry interval moves the clock with the
clockfixture. For that,_session_github_tokenincore/process.pyreadsclock.monotonic()(the clock seam of refactor(cli): tests control time: time-machine fakes wall-clock reads, and retry and rate-limit waits return at once and are recorded #1320) in place oftime.monotonic(). The behavior does not change. - The tests of the unauthenticated error answer
gh auth tokenthroughprocess_fake. - The tests that check the environment of the child keep the stdlib
subprocess.rundouble. They testDefaultProcessRunner, which is the real implementation of the process seam, anddocs/TESTING.mdallows the double of a stdlib edge.
Out of scope (other items of #1333): config, git, dry-run and root, http, exceptions/lang/models, the accommodations (async reroute, PYTEST_CURRENT_TEST, settings cache key, cache_clear), dead code, renames and splits of files, and the private imports and internal patches of the other core test files that are not about the process or the GitHub token.
Target Subsystem
SDLC, Git & PR Governance
Acceptance criteria
- No test in
tests/core/patchesdevops_cli.core.process.run_subprocess. - No test in
tests/core/assigns or readsprocess._github_tokenorprocess._github_lookup_failure. - The retry interval of the failed lookup is tested with the
clockfixture. - The lookup of the unauthenticated error is tested through
process_fake. - A change of the product code (the retry, the JSON parse) makes the migrated tests fail.
-
uv run devops cipasses.
Existing Tool Considered
pytest, time-machine (the clock fixture) and the shared fakes of tests/support/fakes/ cover the need. This item builds nothing new.
Activity
dan-petty commentedon Nov 6, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
testprefix of the title gives the type.core, and .github/labels.yml declares no scope/core label. Add the label to the file to give the scope to this item.It removes fragile private-state access in tests but does not fix a user-facing defect.It makes two core test files robust and aligned with the project fake strategy, but user-facing behaviour is unchanged.It migrates two test files, adds a clock seam in one production function, and verifies six acceptance criteria.Both target core test files using edge fakes; #1333 owns all 36 files while this candidate migrates only the two process and GitHub-token files.