Improve UsageError with invalid -o style (#6795)
This started from fixing the test, where `"xdist_strict True"` was used as a single argument, although you typically would see `["xdist_strict", "True"]`. Improves the error message to mention the option that caused the error.
This commit is contained in:
@@ -1131,7 +1131,11 @@ class Config:
|
||||
try:
|
||||
key, user_ini_value = ini_config.split("=", 1)
|
||||
except ValueError:
|
||||
raise UsageError("-o/--override-ini expects option=value style.")
|
||||
raise UsageError(
|
||||
"-o/--override-ini expects option=value style (got: {!r}).".format(
|
||||
ini_config
|
||||
)
|
||||
)
|
||||
else:
|
||||
if key == name:
|
||||
value = user_ini_value
|
||||
|
||||
Reference in New Issue
Block a user