[claude] Add unit tests for src/config.py (#1172) #1175

Merged
Rockachopa merged 1 commits from :claude/issue-1172 into main 2026-03-23 20:46:55 +00:00

1 Commits

Author SHA1 Message Date
Alexander Whitestone
d457904598 test: add unit tests for src/config.py (issue #1172)
Some checks failed
Tests / lint (pull_request) Has been cancelled
Tests / test (pull_request) Has been cancelled
Add tests/unit/test_config.py with pytestmark=pytest.mark.unit so the
tests are picked up by tox -e unit. Covers:

- normalize_ollama_url helper (6 cases)
- Settings defaults for all major fields
- normalized_ollama_url property
- Env var overrides for strings, bools, ints, floats, Literals
- Type validation and pydantic ValidationError paths
- Edge cases: empty strings, zero/negative ints, large values
- _compute_repo_root auto-detection
- model_post_init gitea_token file fallback
- check_ollama_model_available (OSError, found, not found, exact match, startswith)
- get_effective_ollama_model fallback chain
- validate_startup: test-mode skip, dev warnings, production sys.exit guards
- APP_START_TIME and module-level settings singleton

Refs #1172

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 16:40:54 -04:00