Skip to content

🧪 test(config): assert full error messages for all config fields#3840

Merged
gaborbernat merged 2 commits intotox-dev:mainfrom
gaborbernat:feat/3831-config-errors
Feb 27, 2026
Merged

🧪 test(config): assert full error messages for all config fields#3840
gaborbernat merged 2 commits intotox-dev:mainfrom
gaborbernat:feat/3831-config-errors

Conversation

@gaborbernat
Copy link
Copy Markdown
Member

PR #3838 introduced clean error messages for TOML config type mismatches, but the tests only verified partial messages or covered a handful of fields. This makes it easy for regressions to slip through where the context prefix (failed to load <env>.<key>: ...) gets silently dropped, or where a specific field type produces an unhelpful error that nobody notices until a user hits it.

This adds a comprehensive parametrized test that exercises every user-configurable field type against the error reporting path: str, bool, int, float, Path, list[str], set[str], list[Command], EnvList, and factory-based fields (deps, constraints). 🧪 Each test case feeds an invalid TOML value and asserts the full error message includes both the field context and the type-specific detail. The existing toml_loader and req_file tests are also tightened to assert the complete "failed to load A.k: <detail>" format rather than just matching the inner fragment.

Follows up on #3838. Relates to #3831.

The error message tests from tox-dev#3838 only checked partial messages or a
handful of fields. This makes it hard to catch regressions where the
context prefix ("failed to load <env>.<key>: ...") gets lost or where
specific field types produce unhelpful errors.

Adds a comprehensive parametrized test covering every user-configurable
field type: str, bool, int, float, Path, list[str], set[str],
list[Command], EnvList, and factory-based fields (deps, constraints).
Updates existing toml_loader and req_file tests to assert the complete
error message including the field context prefix.
@gaborbernat gaborbernat enabled auto-merge (squash) February 27, 2026 19:05
@gaborbernat gaborbernat merged commit f1083c0 into tox-dev:main Feb 27, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant