Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pytest 8.1.0 compatibility #119

Closed
anilbey opened this issue Mar 4, 2024 · 7 comments · Fixed by #120
Closed

Pytest 8.1.0 compatibility #119

anilbey opened this issue Mar 4, 2024 · 7 comments · Fixed by #120

Comments

@anilbey
Copy link

anilbey commented Mar 4, 2024

Hi,

I think an update is required in to be compatible with Pytest 8.1.0.
Source (CI logs of a project): https://github.com/BlueBrain/BlueCelluLab/actions/runs/8138274377/job/22239014458?pr=142
The packages installed as well as the environment can be found on the CI logs.

     File "/home/runner/work/BlueCelluLab/BlueCelluLab/.tox/examples/lib/python3.11/site-packages/_pytest/config/__init__.py", line 1490, in parse
      self._preparse(args, addopts=addopts)
    File "/home/runner/work/BlueCelluLab/BlueCelluLab/.tox/examples/lib/python3.11/site-packages/_pytest/config/__init__.py", line 1377, in _preparse
      self.pluginmanager.load_setuptools_entrypoints("pytest11")
    File "/home/runner/work/BlueCelluLab/BlueCelluLab/.tox/examples/lib/python3.11/site-packages/pluggy/_manager.py", line 415, in load_setuptools_entrypoints
      self.register(plugin, name=ep.name)
    File "/home/runner/work/BlueCelluLab/BlueCelluLab/.tox/examples/lib/python3.11/site-packages/_pytest/config/__init__.py", line 497, in register
      plugin_name = super().register(plugin, name)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/runner/work/BlueCelluLab/BlueCelluLab/.tox/examples/lib/python3.11/site-packages/pluggy/_manager.py", line 167, in register
      self._verify_hook(hook, hookimpl)
    File "/home/runner/work/BlueCelluLab/BlueCelluLab/.tox/examples/lib/python3.11/site-packages/pluggy/_manager.py", line 342, in _verify_hook
      raise PluginValidationError(
  pluggy._manager.PluginValidationError: Plugin 'nbmake' for hook 'pytest_collect_file'
  hookimpl definition: pytest_collect_file(path: str, parent: Any) -> Optional[Any]
  Argument(s) {'path'} are declared in the hookimpl but can not be found in the hookspec

Related discussion on pytest: pytest-dev/pytest#12065 (comment)

@alex-treebeard
Copy link
Member

alex-treebeard commented Mar 4, 2024

Thanks for this report! I sense this is disruptive so am looking into it ASAP.

In the meantime, it would be really awesome if you joined our new Discord. Communities can help prevent issues like as well as identify new helpful things to build for you.

https://discord.gg/QFjCpMjqRY

@alex-treebeard
Copy link
Member

So it appears that the path parameter to collect has now been removed in favour of a file_path which uses the Pathlib type.

Relevant github issue

I'd like to fix this in a way that keeps support for Pytest 7 although simplest thing to do would be to support >8 going forward. Open to suggestions.

@ManonMarchand
Copy link

What about something that detects the major version of pytest?

@alex-treebeard
Copy link
Member

@ManonMarchand thanks that's what I did -- it should work the same for pytest 6 and 7

Fixed in release v1.5.1

@anilbey
Copy link
Author

anilbey commented Mar 4, 2024

Thanks @alex-treebeard for the quick fix.

@anilbey
Copy link
Author

anilbey commented Mar 4, 2024

It appears pytest 8.1.0 is yanked.
https://pypi.org/project/pytest/8.1.0/

@alex-treebeard
Copy link
Member

😄 I did feel like there was no warning about this change... we are ok though as far as I know, apart from the dev environment for nbmake being on 8.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants