Give run_tokens a direct test seam#50
Merged
Merged
Conversation
Final review noted the removed full-script test carried a direct
entrypoint_tokens({'entrypoint': []}) == [] assertion that did not migrate
to TestRunTokens. The behavior stays pinned there, but the convention is
worth keeping at its own level.
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
emit.py's_run_tokenstorun_tokens— package-internal but directly testable, matching the existing precedent ofreferenced_variables/command_tokens/entrypoint_tokensin the same file (none are in__all__)._run_tokensheld the real subtlety of howentrypointandcommandcompose (string-form entrypoint drops the service command; list-form prepends only its first token as--entrypoint; a--commandoverride lands positionally after the entrypoint's tokens) — yet no test imported it. Every ordering assertion went throughemit_script()and searched the rendered, shell-quoted script for substrings and.index()positions.TestRunTokens: 5 tests asserting directly on the returnedlist[Token]. These pin strictly more than the tests they replace — they can see theExpandvs plain-strtoken distinction that string-search structurally cannot, which is what makesreferenced_variablescorrectly exclude--commandoverride vars.test_command_override_still_applies_with_entrypointas the end-to-end smoke test (it exercises both_renderbranches). No rendering-coverage gap: list-form entrypoint quoting stays pinned by an untouched test, and 10 integration scenarios execute the real generated scripts under podman._planhad a local variable and_emit_targeta parameter both namedrun_tokens; making the function public without renaming them would have caused a genuineUnboundLocalError. Both are nowtokens.Full rationale:
planning/changes/2026-07-13.08-public-run-tokens.md.Test plan
just test-ci— 407 passed, 100% line coveragejust lint-ci— cleanentrypoint_tokens([]) == []assertion that didn't migrate) is fixed in b0db043