Background & Motivation
The load_config function in wptgen/config.py has been significantly refactored, adding numerous optional parameters to support new features (resume-from, state-dir, lightweight/reasoning models, etc.). Currently, many CLI tests in tests/test_main.py (like test_audit_success and test_chromestatus_command) perform partial assertions on the load_config call's keyword arguments.
While this approach works, it is less robust than performing a full comparison against a set of expected default values. A more maintainable pattern is to use a central fixture, such as default_load_config_kwargs, to provide a baseline of expected arguments and then override only the ones relevant to a specific test case.
Proposed Changes
- Update all CLI command tests in
tests/test_main.py (e.g., test_generate_success, test_audit_success, test_chromestatus_command, test_list_models_command, etc.) to use mock_load_config.assert_called_once_with(**expected_kwargs).
- Ensure
expected_kwargs is derived from a default_load_config_kwargs fixture to minimize boilerplate and improve consistency.
- Standardize the way CLI flags are validated to ensure all parameters are correctly passed to the configuration layer.
Acceptance Criteria
This issue description was drafted by Gemini
Background & Motivation
The
load_configfunction inwptgen/config.pyhas been significantly refactored, adding numerous optional parameters to support new features (resume-from, state-dir, lightweight/reasoning models, etc.). Currently, many CLI tests intests/test_main.py(liketest_audit_successandtest_chromestatus_command) perform partial assertions on theload_configcall's keyword arguments.While this approach works, it is less robust than performing a full comparison against a set of expected default values. A more maintainable pattern is to use a central fixture, such as
default_load_config_kwargs, to provide a baseline of expected arguments and then override only the ones relevant to a specific test case.Proposed Changes
tests/test_main.py(e.g.,test_generate_success,test_audit_success,test_chromestatus_command,test_list_models_command, etc.) to usemock_load_config.assert_called_once_with(**expected_kwargs).expected_kwargsis derived from adefault_load_config_kwargsfixture to minimize boilerplate and improve consistency.Acceptance Criteria
test_audit_successusesassert_called_once_withwith a full set of expected arguments.test_chromestatus_commandusesassert_called_once_withwith a full set of expected arguments.tests/test_main.pyare refactored to use the same pattern.tests/test_main.pypass after the refactor.This issue description was drafted by Gemini