RFC: provide warns with a behavior similar to raises #2708
Comments
Hi @massich, thanks for writing.
I think so, this definitely feels like a small oversight. We should take care to reuse the overlapping functionality to avoid introducing bugs and to ensure from now on improvements to one reflect on the other. One question which is not clear:
My initial gut feeling is 1) and probably fits the current style of comparing against the records object, but I also see that 2) can be more convenient.
Sure, please go ahead. |
When dealing with the messages thrown by warnings (IMHO) it would great if we could use the same calls as for the
raises
case. As example, this would allow for:I have implemented such behavior by wrapping
pytest.warns
here in the following manner:Do you think is a valuable feature? Do you think that a PR implementing such behavior is useful to anyone? I'm sure I'm not the first one to wander why
warns
has different signature thanraises
. Therefore I can only guess that is not that easy to integrate it to pytest. But If you think that PR is in order I'll be happy to do it.The text was updated successfully, but these errors were encountered: