Files
cleveragents-core/features/config_cli_uncovered_branches.feature
freemo ca1c341b18
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 14s
CI / build (pull_request) Successful in 17s
CI / quality (pull_request) Successful in 19s
CI / security (pull_request) Successful in 28s
CI / typecheck (pull_request) Successful in 32s
CI / integration_tests (pull_request) Successful in 2m39s
CI / unit_tests (pull_request) Successful in 5m22s
CI / docker (pull_request) Successful in 38s
CI / benchmark-regression (pull_request) Successful in 17m47s
CI / coverage (pull_request) Successful in 19m6s
CI / lint (push) Successful in 14s
CI / build (push) Successful in 15s
CI / quality (push) Successful in 20s
CI / security (push) Successful in 29s
CI / typecheck (push) Successful in 36s
CI / benchmark-regression (push) Has been skipped
CI / integration_tests (push) Successful in 3m23s
CI / unit_tests (push) Successful in 9m12s
CI / docker (push) Successful in 16s
CI / benchmark-publish (push) Successful in 10m4s
CI / coverage (push) Successful in 19m27s
Tests: Significantly improved coverage of the unit tests
2026-02-22 00:43:08 -05:00

59 lines
3.3 KiB
Gherkin

Feature: Config CLI uncovered branches
Cover missed lines and branches in config.py:
_settings_defaults factory/None paths, _validate_key empty,
_write_config_file existing-file path, _resolve_source env path,
config_set/get non-rich formats, config_list empty result.
# -- _settings_defaults with default_factory (L81-85) --
Scenario: config cli branch settings defaults uses default_factory when default is None
Given a config cli branch mocked Settings with a default_factory field
When I config cli branch call _settings_defaults
Then the config cli branch defaults should contain the factory value
# -- _settings_defaults with both default and factory None (L87) --
Scenario: config cli branch settings defaults returns None when no default and no factory
Given a config cli branch mocked Settings with a None-only field
When I config cli branch call _settings_defaults
Then the config cli branch defaults should contain None for the field
# -- _validate_key with empty key (L102-103) --
Scenario: config cli branch validate_key rejects empty key
When I config cli branch call _validate_key with an empty key
Then the config cli branch call should raise BadParameter
# -- _write_config_file when file already exists (L145-147) --
Scenario: config cli branch write_config_file merges into existing file
Given a config cli branch temp config directory
And a config cli branch existing config file with key "log_level" set to "DEBUG"
When I config cli branch write config with key "server_port" set to "9090"
Then the config cli branch config file should contain both keys
# -- _resolve_source returns "env" (L169-170) --
Scenario: config cli branch resolve_source returns env when env var is set
Given a config cli branch temp config directory
And the config cli branch env var "CLEVERAGENTS_LOG_LEVEL" is set to "WARNING"
When I config cli branch call _resolve_source for "log_level"
Then the config cli branch source should be "env"
# -- config_set with non-rich format (L261-262) --
Scenario: config cli branch config set with json format uses format_output
Given a config cli branch temp config directory
When I config cli branch run config set "log_level" "DEBUG" with format "json"
Then the config cli branch set result should be valid JSON
And the config cli branch set JSON should contain key "key"
And the config cli branch set JSON should contain key "value"
# -- config_get with non-rich format and Path value (L311-312, L314-315) --
Scenario: config cli branch config get with json format serialises Path values
Given a config cli branch temp config directory
And config cli branch settings_fields returns a Path value for "log_dir"
When I config cli branch run config get "log_dir" with format "json"
Then the config cli branch get result should be valid JSON
And the config cli branch get JSON value should be a string not a Path
# -- config_list with filter matching nothing (L422-423) --
Scenario: config cli branch config list prints message when no matches
Given a config cli branch temp config directory
When I config cli branch run config list with pattern "zzz_nonexistent_pattern_xyz"
Then the config cli branch list output should say no values match