matplotlib/pytest-mpl

Upgrade to new-style hook wrappers

ConorMacBride opened this issue · 3 comments

Pytest 8 will use the new-style hook wrappers so we should add a version check to update the decorator for our pytest_runtest_call hooks.

See also: pytest-dev/pytest#11714

Also re-enable the pytestdev test environment.

pllim commented

Actually I didn't really upgrade to new style. I simply copy-pasted the suggested workaround by pytest dev, so maybe you should re-open this issue. I apologize for any inconvenience caused.

Yes, I realised that, but I think how you fixed it is better. The pluggy documentation now recommends using force_exception so we are effectively adding proper support for newer pluggy versions, regardless of the pytest version installed.

To add the new-style hook wrappers we'd need to do version checks on pytest to decide which kwargs to pass to the hooks, which might be unnecessary mess? The old-style hook wrappers will likely be supported for a long time yet. I'll reopen this issue though, as we should upgrade at some point. v1.0.0 would probably make sense.

Pluggy 1.4.0 (just released) now warns about old-style hook wrappers (xref #221). This breaks any CI that treats warnings as errors.