Produce a warning when unknown arguments are passed to pytest.param()

This commit is contained in:
Anthony Sottile
2019-04-12 08:04:27 -07:00
parent a9e850f749
commit 43e7401c91
6 changed files with 31 additions and 6 deletions

View File

@@ -682,7 +682,7 @@ def raises(expected_exception, *args, **kwargs):
match_expr = kwargs.pop("match")
if kwargs:
msg = "Unexpected keyword arguments passed to pytest.raises: "
msg += ", ".join(kwargs.keys())
msg += ", ".join(sorted(kwargs))
raise TypeError(msg)
return RaisesContext(expected_exception, message, match_expr)
elif isinstance(args[0], str):