Closed JamesMakela-NOAA closed 5 years ago
Unfortunately, with the release of pytest 4, this is now a breaking issue :sob:. Ideally I think there could be an easier/less verbose way of passing in the mark with a keyword argument. I've opened an issue with them though - we'll see what they say: https://github.com/pytest-dev/pytest/issues/4395
I'm totally up for changing the tests, but, unfortunately, I don't really have time right now to do this. I will gladly work with anyone who wants to create a pr for this issue though.
This issue is really a pain in the ass now. Sorry, but it will take even more time for somebody who does not know your code and/or pytest
framework development internals to achieve the same goal.
As I was going through the tests within this project, I noticed there are no tests for parameterization of exceptions via pytest.param, passing in 'marks='.
A little background: In the past, it has been an acceptable practice to pass pytest.mark.raises directly into your parametrize list if you want to parametrize a test that raises an expected exception. But now, if you are using a newer version of pytest, you will in fact get a deprecation warning.
Although the tests don't technically fail, it is annoying to get a bunch of these warnings, especially if you are using a lot of parametrization in your test suite. Here is an example of the idiom to which one should probably migrate:
And although a bit more verbose, it conforms to the newer pytest, and the warnings go away.
To be clear, pytest-raises version 0.10 does support this and it is working fine for me. I just didn't see a pytest which documents and verifies this specific feature within the project.