pytest-dev/pytest

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

pllim commented

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:

Example logs:

Plugins:

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):
       ...
pllim commented

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

pllim commented

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.