John Litborn

Results 429 comments of John Litborn

> Related to #10441 which was marked as fixed in #11424 (not yet released). The main blocker here is someone designing an interface which: > > * is convenient to...

`raises` is quite messy, and would be more so with my suggestion (though most of the complexity would lie in `ExpectedExceptionGroup` - not in `raises`), but I think pytest needs...

> How does this proposal handle the case of matching behaviour of except*, which does not care about nesting level of group? good question - I was not thinking of...

> We're passing inner exception instances, _but_ interpreting their `__str__` (which is usually _but not always_ equal to the message string) as a regex pattern to search by, instead of...

> I think that having one new keyword-only argument to `raises()` is going to be easier on users than introducing a new `ExpectedExceptionGroup` type. > > Concretely, this might look...

If we want to step away from `pytest.raises`, and also not have a type, - an alternative could be something like ```python with pytest.groupraises( ValueError, pytest.groupraises( SyntaxError, ) ): ......

> I recall recommending external Experiments before trying to get this into core main downside to this is needing to duplicate functionality from pytest in the external package, or relying...

> > We're passing inner exception instances, but interpreting their **str** (which is usually but not always equal to the message string) > > Definitely -1 for me, custom exceptions...

@nicoddemus see #11671 for a sketch implementation that uses ```python with pytest.RaisesGroup(ValueError): raise ExceptionGroup("", (ValueError,)) ``` or a more complicated example ```python with pytest.RaisesGroup( ValueError, Matcher(SyntaxError, match="syntaxerror message"), pytest.RaisesGroup(TypeError, match="nested_group_message")...

Quite similar, I wouldn't mind if something like the above got adopted. The tuples definitely causes a bit of confusion, e.g. is the following allowed: ```python with pytest.raises( Match( (MyExceptionGroupSubclass1,...