On Thu, Mar 30, 2017 at 4:32 PM holger krekel <[email protected]> wrote:

> It's a bit odd to introduce a new helper just for this particular case.
> After skimming https://github.com/pytest-dev/pytest/issues/1830
> i'd prefer the mentioned pytest.raises(None) solution which lets through
> all exceptions
> of the dependent code block.  Adding an example to the pytest docs and
> extending
> the pytest.raises help string and implementation would be enough IMO.
> By contrast, adding a new helper feels like unneccessary clutter of
> the pytest.* namespace. The above would then be:
>
>  @pytest.mark.parametrize('inp, expectation', [
>      (-1, ValueError),
>      (3.5, TypeError),
>      (5, None),
>      (10, None)])
>  def test_bar(inp, expectation):
>      with pytest.raises(expectation):
>          validate_positive_integer(inp)
>
> where the parametrization is shorter and if one does not know
> what pytest.raises(None) means one could find it easily in the
> doc string or the pytest docs.
>

I agree. Does anybody else still prefers the original proposal?

Cheers,
Bruno.
_______________________________________________
pytest-dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pytest-dev

Reply via email to