Improve error message for malformed pyproject.toml files
Including the file name is enough to let the user know what the problem is. The same is not needed for `.ini` files because the error message includes the path to the file by default. Fix #9730
This commit is contained in:
@@ -70,7 +70,7 @@ def load_config_dict_from_file(
|
||||
try:
|
||||
config = tomli.loads(toml_text)
|
||||
except tomli.TOMLDecodeError as exc:
|
||||
raise UsageError(str(exc)) from exc
|
||||
raise UsageError(f"{filepath}: {exc}") from exc
|
||||
|
||||
result = config.get("tool", {}).get("pytest", {}).get("ini_options", None)
|
||||
if result is not None:
|
||||
|
||||
Reference in New Issue
Block a user