🧪 test(config): assert full error messages for all config fields#3840
Merged
gaborbernat merged 2 commits intotox-dev:mainfrom Feb 27, 2026
Merged
🧪 test(config): assert full error messages for all config fields#3840gaborbernat merged 2 commits intotox-dev:mainfrom
gaborbernat merged 2 commits intotox-dev:mainfrom
Conversation
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.
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.
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 existingtoml_loaderandreq_filetests 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.