xarray-contrib / xdggs

Xarray extension for DGGS
Apache License 2.0
54 stars 9 forks source link

testing utils for exception groups #55

Closed keewis closed 3 months ago

keewis commented 3 months ago

We're making use of exception groups in the grid objects to return all issues with the attributes in a single exception group. However, pytest does not support matching exception groups (instead, its documentation states that excinfo.group_contains should be used to assert the structure of the caught exception group).

While possible, this means we can't use parametrize to generate lots of test cases.

Instead, here's two ways to make assertions about the structure of a exception group:

keewis commented 3 months ago

this most certainly could use some improvements and the Match API still feels kinda weird, but for now I think this is good enough to make use of in other PRs.