pytest 8.1.dev gives {'path'} are declared in the hookimpl but can not be found in the hookspec
pllim opened this issue ยท 4 comments
Hi. With pytest 8.1.dev , I see this error when collecting plugins in a couple of repos:
{'path'} are declared in the hookimpl but can not be found in the hookspec
This is not a problem even with pytest 8.0rc.
Related issues/comments:
- astropy/astropy#15810
- astropy/pytest-filter-subpackage#14
- astropy/pytest-arraydiff#45 (comment) cc @bsipocz
Example logs:
- https://github.com/scientific-python/pytest-doctestplus/actions/runs/7382066201/job/20176149354#step:5:112 (note that for this one, only pytest-dev in OSX failed but not pytest-dev in Windows or Linux)
- https://github.com/astropy/astropy/actions/runs/7375363390/job/20170602594 (this one fails on Linux, no other OS runs pytest-dev here)
Plugins:
- https://github.com/astropy/pytest-filter-subpackage
- https://github.com/scientific-python/pytest-doctestplus
Can you please advise how to fix? Thank you! ๐
As part of the py.path -> pathlib.Path transition, the py.path hook parameters have been deprecated in the 7.x series, changed to an error in 8.0, and finally removed in 8.1. It seems like the pytest_ignore_collect hook implementation in the pytest_filter_subpackage plugin still uses the deprecated path argument, should use collection_path instead (available since pytest 7.0.0).
If you can require pytest>=7, then can just replace path -> collection_path (and possibly adjust for py.path.local -> Path).
If you still need to support pytest<7, you'll have to do something like the following I'm afraid:
if PYTEST_GTE_7:
def pytest_ignore_collect(collection_path):
...
else:
def pytest_ignore_collect(path):
...Thank you for your prompt response!
parameters have been deprecated in the 7.x series
@pllim - I wonder why we didn't choke on the deprecation warning
Not sure. In doctestplus, look like updates were made to handle things as Path post pytest 7 but we did not change the actual function signature.