Summary
pytest.raises can be used not only as a context manager but also as a function that takes a function to call for specified exception. In that case match parameter cannot be passed to the pytest.raises but can be checked on the returned exception info.
pytest.raises(Exception, func, *func_args, **func_kwargs).match("error message")
This line should not trigger PT011 error.
Version
0.11.2