Replace **kwargs with explicit parameters in test mocks#98
Merged
Conversation
Replace trailing **kwargs catch-alls on monkeypatched doubles with the full explicit signature of the boundary they stand in for (stream_audio, agent run_session, run_login_flow, llm.run_chain, coding_agent.run, subprocess.run/Popen, httpx.get, typer.confirm, run_init, launch_app, Console.status), so a renamed/removed/typo'd kwarg at the call site fails loudly with a TypeError instead of being silently swallowed. Left intact, deliberately: - delegating wrappers (httpx.Client/os.access) where the real callee enforces the signature - fakes whose captured kwargs dict is itself the assertion subject (exact-set or absence asserts in test_telemetry/test_init_runner) - never-called trackers whose tests assert zero invocations https://claude.ai/code/session_01XVarv54ryA8Eo9zohCKx77
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.
Replace catch-all
**kwargsand**_kwargsparameters with explicit keyword-only parameters in test mock functions to improve type safety and clarity.Summary
This change systematically updates test mock functions across the test suite to use explicit keyword-only parameters instead of catch-all
**kwargsor**_kwargs. This improves code clarity, enables better type checking, and makes the expected function signatures more discoverable.Key Changes
stream_audiofunctions to explicitly declareon_begin,on_turn, andon_terminationparameters instead of**_kwargsrun_sessionmocks to explicitly declarerenderer,player,mic, andconfigparameters_fake_run_initand_fake_launchto explicitly list all expected keyword argumentsfake_getandfake_popento use explicit parameters (headers,timeout,follow_redirects,stdout,stderr,start_new_session,env)json_modeparametertimeoutparameterfake_confirmandfake_runwith explicit parameterscapture_output,text, andcheckparametersjson_modeparameter**_kwargsfrom login result helpermessageparameterstdoutandstderrparametersImplementation Details
All changes maintain backward compatibility with the calling code while making the function signatures more explicit and type-safe. This pattern aligns with the project's emphasis on strict typing and clarity in test code.
https://claude.ai/code/session_01XVarv54ryA8Eo9zohCKx77