Skip to content

Could not start tests due to HookimplMarker.__call__() got an unexpected keyword argument 'wrapper' #23707

Closed

Description

@somenewacc

Type: Bug

Behaviour

When I try to refresh or start tests error occurs:

2024-06-26 14:23:27.341 [error]     exec(co, module.__dict__)
  File "/home/.vscode-server/extensions/ms-python.python-2024.9.2024062507-linux-x64/python_files/vscode_pytest/__init__.py", line 895, in <module>
    class DeferPlugin:
  File "/home/.vscode-server/extensions/ms-python.python-2024.9.2024062507-linux-x64/python_files/vscode_pytest/__init__.py", line 896, in DeferPlugin

2024-06-26 14:23:27.341 [error]     @pytest.hookimpl(wrapper=True)
TypeError: HookimplMarker.__call__() got an unexpected keyword argument 'wrapper'

Steps to reproduce:

  1. Install python extension v2024.9.2024062601
  2. Install pytest python module pytest==7.1.2 and pluggy==1.0.0
  3. Try to run or refresh tests

Related to: #23539
Added in pluggy 1.2.0: pytest-dev/pluggy@e241aed

Diagnostic data

Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)

2024-06-26 14:23:27.340 [error] Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main

2024-06-26 14:23:27.340 [error]     return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/.local/lib/python3.10/site-packages/pytest/__main__.py", line 5, in <module>
    raise SystemExit(pytest.console_main())
  File "/home/.local/lib/python3.10/site-packages/_pytest/config/__init__.py", line 187, in console_main
    code = main()
  File "/home/.local/lib/python3.10/site-packages/_pytest/config/__init__.py", line 145, in main
    config = _prepareconfig(args, plugins)
  File "/home/.local/lib/python3.10/site-packages/_pytest/config/__init__.py", line 324, in _prepareconfig
    config = pluginmanager.hook.pytest_cmdline_parse(
  File "/home/.local/lib/python3.10/site-packages/pluggy/_hooks.py", line 265, in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
  File "/home/.local/lib/python3.10/site-packages/pluggy/_manager.py", line 80, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/home/.local/lib/python3.10/site-packages/pluggy/_callers.py", line 55, in _multicall
    gen.send(outcome)
  File "/home/.local/lib/python3.10/site-packages/_pytest/helpconfig.py", line 102, in pytest_cmdline_parse
    config: Config = outcome.get_result()
  File "/home/.local/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/home/.local/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
    res = hook_impl.function(*args)
  File "/home/.local/lib/python3.10/site-packages/_pytest/config/__init__.py", line 1016, in pytest_cmdline_parse

2024-06-26 14:23:27.340 [error]     self.parse(args)
  File "/home/.local/lib/python3.10/site-packages/_pytest/config/__init__.py", line 1304, in parse

2024-06-26 14:23:27.341 [error]     self._preparse(args, addopts=addopts)
  File "/home/.local/lib/python3.10/site-packages/_pytest/config/__init__.py", line 1183, in _preparse

2024-06-26 14:23:27.341 [error]     self.pluginmanager.consider_preparse(args, exclude_only=False)
  File "/home/.local/lib/python3.10/site-packages/_pytest/config/__init__.py", line 674, in consider_preparse
    self.consider_pluginarg(parg)
  File "/home/.local/lib/python3.10/site-packages/_pytest/config/__init__.py", line 700, in consider_pluginarg
    self.import_plugin(arg, consider_entry_points=True)
  File "/home/.local/lib/python3.10/site-packages/_pytest/config/__init__.py", line 746, in import_plugin
    __import__(importspec)
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "/home/.local/lib/python3.10/site-packages/_pytest/assertion/rewrite.py", line 168, in exec_module

2024-06-26 14:23:27.341 [error]     exec(co, module.__dict__)
  File "/home/.vscode-server/extensions/ms-python.python-2024.9.2024062507-linux-x64/python_files/vscode_pytest/__init__.py", line 895, in <module>
    class DeferPlugin:
  File "/home/.vscode-server/extensions/ms-python.python-2024.9.2024062507-linux-x64/python_files/vscode_pytest/__init__.py", line 896, in DeferPlugin

2024-06-26 14:23:27.341 [error]     @pytest.hookimpl(wrapper=True)
TypeError: HookimplMarker.__call__() got an unexpected keyword argument 'wrapper'

Extension version: 2024.8.1
VS Code version: Code 1.90.1 (611f9bfce64f25108829dd295f54a6894e87339d, 2024-06-11T21:01:24.262Z)
OS version: Windows_NT x64 10.0.22631
Modes:
Remote OS version: Linux x64 5.15.153.1-microsoft-standard-WSL2

  • Python version (& distribution if applicable, e.g. Anaconda): 3.10.12
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Global
  • Value of the python.languageServer setting: Default
User Settings


languageServer: "Pylance"

testing
• pytestArgs: "<placeholder>"
• pytestEnabled: true

Installed Extensions
Extension Name Extension Id Version
autoDocstring - Python Docstring Generator njpwerner.autodocstring 0.6.1
Code Spell Checker streetsidesoftware.code-spell-checker 3.0.1
Diff fabiospampinato.vscode-diff 2.1.2
Django batisteo.vscode-django 1.15.0
Docker ms-azuretools.vscode-docker 1.29.1
ESLint dbaeumer.vscode-eslint 3.0.10
Flake8 ms-python.flake8 2023.10.0
GitLens — Git supercharged eamodio.gitlens 15.1.0
Hex Editor ms-vscode.hexeditor 1.10.0
IntelliCode VisualStudioExptTeam.vscodeintellicode 1.3.1
IntelliCode API Usage Examples VisualStudioExptTeam.intellicode-api-usage-examples 0.2.8
isort ms-python.isort 2023.10.1
JavaScript Debugger ms-vscode.js-debug 1.90.0
Jupyter ms-toolsai.jupyter 2024.5.0
Jupyter Cell Tags ms-toolsai.vscode-jupyter-cell-tags 0.1.9
Jupyter Notebook Renderers ms-toolsai.jupyter-renderers 1.0.18
Jupyter Slide Show ms-toolsai.vscode-jupyter-slideshow 0.1.6
Markdown All in One yzhang.markdown-all-in-one 3.6.2
Mypy matangover.mypy 0.3.1
Mypy Type Checker ms-python.mypy-type-checker 2023.6.0
Pylance ms-python.vscode-pylance 2024.6.102
pytest-fixtures nickmillerdev.pytest-fixtures 0.3.3
Python ms-python.python 2024.9.2024062507
Python Debugger ms-python.debugpy 2024.7.11591012
Python Environment Manager donjayamanne.python-environment-manager 1.2.4
Python Extension Pack donjayamanne.python-extension-pack 1.7.0
Russian - Code Spell Checker streetsidesoftware.code-spell-checker-russian 2.2.2
SonarLint SonarSource.sonarlint-vscode 4.6.0
Table Visualizer for JavaScript Profiles ms-vscode.vscode-js-profile-table 1.0.9
System Info
Item Value
CPUs 12th Gen Intel(R) Core(TM) i7-12700H (20 x 2688)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) undefined
Memory (System) 63.71GB (33.48GB free)
Process Argv --crash-reporter-id 4409da24-6d84-409b-9436-b00c7b3b03c3
Screen Reader no
VM 0%
Item Value
Remote WSL: Ubuntu
OS Linux x64 5.15.153.1-microsoft-standard-WSL2
CPUs 12th Gen Intel(R) Core(TM) i7-12700H (20 x 0)
Memory (System) 31.20GB (24.39GB free)
VM 0%
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscorecescf:30445987
vscod805:30301674
binariesv615:30325510
vsaa593:30376534
py29gd2263:31024239
vscaac:30438847
c4g48928:30535728
azure-dev_surveyone:30548225
2i9eh265:30646982
962ge761:30959799
pythongtdpath:30769146
welcomedialogc:30910334
pythonnoceb:30805159
asynctok:30898717
pythonregdiag2:30936856
pythonmypyd1:30879173
h48ei257:31000450
pythontbext0:30879054
accentitlementst:30995554
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
jchc7451:31067544
chatpanelc:31048052
dsvsc021:30996838
945dj816:31013170
pythoncenvpt:31062603
a69g1124:31058053
dvdeprecation:31068756
dwnewjupyter:31046869
legacy_priority:31082724

Activity

  1. added
    triage-needed
    on Jun 26, 2024
  2. eleanorjboyd commented on Jun 26, 2024

    @eleanorjboyd

    Hi! Is there any reason you need to stay on pytest version 7? Pytest is now on version 8 so we are looking to move people here for their versioning. Thanks

  3. added
    info-needed
    on Jun 26, 2024
  4. somenewacc commented on Jun 26, 2024

    @somenewacc
    Author

    Eleanor Boyd (@eleanorjboyd), hi.
    idk about it, this version is used on my project.

    no option for backwards compatibility?

  5. removed
    info-needed
    on Jun 26, 2024
  6. DetachHead commented on Jun 28, 2024

    @DetachHead

    when i added this hook in #23539 i tried using the old hookwrapper argument instead of the new wrapper one for backwards compatibility, but it seemed to prevent the hook from ever getting called and i couldn't figure out why.

    if pytest 7 still needs to be supported, perhaps this hook can be conditionally defined depending on the version of pytest that the user has installed?

  7. eleanorjboyd commented on Jul 1, 2024

    @eleanorjboyd

    DetachHead and somenewacc, yes lets do something for backwards compatibility, I will investigate

  8. eleanorjboyd commented on Jul 1, 2024

    @eleanorjboyd

    Hi somenewacc, I went and replicated your environment myself and am not able to see the issue arise. My pytest info is: platform darwin -- Python 3.10.14, pytest-7.1.2, pluggy-1.0.0. Are there any discrepancies to how I set it up? Thanks

  9. added
    info-needed
    on Jul 1, 2024
  10. somenewacc commented on Jul 2, 2024

    @somenewacc
    Author

    Eleanor Boyd (@eleanorjboyd) hi!

    I'm on WSL Ubuntu 22.04 (Linux x64 5.15.153.1-microsoft-standard-WSL2).

    I created simple project:

    1. venv with Python 3.10.12:
      image

    2. Installed pytest==7.1.2 and after that pluggy==1.0.0:

    attrs==23.2.0
    iniconfig==2.0.0
    packaging==24.1
    pluggy==1.0.0
    py==1.11.0
    pytest==7.1.2
    tomli==2.0.1
    
    1. Simple test file:
    def test_a():
        assert True
    1. Configured pytest (from UI, created file .vscode/settings.json):
    {
        "python.testing.pytestArgs": [
            "."
        ],
        "python.testing.unittestEnabled": false,
        "python.testing.pytestEnabled": true
    }
    1. Run "Refresh Tests":
      image

    2. Got error:
      image

    Python extension version: v2024.9.2024062703 (pre-release)

    Hope that helps!

  11. removed
    info-needed
    on Jul 2, 2024
  12. TomskDiver commented on Jul 9, 2024

    @TomskDiver

    Got same error. On VSCode

    Версия: 1.90.1 (user setup)
    Фиксация: 611f9bfce64f25108829dd295f54a6894e87339d
    Дата: 2024-06-11T21:01:24.262Z
    Electron: 29.4.0
    ElectronBuildId: 9593362
    Chromium: 122.0.6261.156
    Node.js: 20.9.0
    V8: 12.2.281.27-electron.0
    ОС: Windows_NT x64 10.0.19045
    

    works fine.
    But autoupdate to

    Версия: 1.91.0 (system setup)
    Фиксация: ea1445cc7016315d0f5728f8e8b12a45dc0a7286
    Дата: 2024-07-01T18:52:22.949Z
    Electron: 29.4.0
    ElectronBuildId: 9728852
    Chromium: 122.0.6261.156
    Node.js: 20.9.0
    V8: 12.2.281.27-electron.0
    ОС: Windows_NT x64 10.0.22631
    

    and got error with pytest.

     File "/root/.vscode-server/extensions/ms-python.python-2024.10.0-linux-x64/python_files/vscode_pytest/__init__.py", line 895, in <module>
        class DeferPlugin:
      File "/root/.vscode-server/extensions/ms-python.python-2024.10.0-linux-x64/python_files/vscode_pytest/__init__.py", line 896, in DeferPlugin
        @pytest.hookimpl(wrapper=True)
    TypeError: __call__() got an unexpected keyword argument 'wrapper'
    
  13. TomskDiver commented on Jul 9, 2024

    @TomskDiver
  14. TomskDiver commented on Jul 9, 2024

    @TomskDiver

    I see documentation: https://pluggy.readthedocs.io/en/stable/index.html#hookwrappers
    The problem is that we are using pluggy 1.0.0 and it dont have new wrapper parameter, but have old hookwrapper.

    Workaround: upgrade pluggy to 1.2.0 minimum (pip install pluggy==1.2.0). Version 1.1.0 was yanked "Caused breakage due to new style hook wrappers. Team will reevaluate." (https://pypi.org/project/pluggy/1.1.0/)

  15. sihcpro commented on Jul 15, 2024

    @sihcpro

    I fixed it by run this command:

    pip install --upgrade pytest

  16. juancrod commented on Jul 15, 2024

    @juancrod

    I fixed it by run this command:

    pip install --upgrade pytest

    This works for me too. Thank you!

  17. eleanorjboyd commented on Jul 15, 2024

    @eleanorjboyd

    I just put in a fix for backwards compatibility as well but upgrading is the best strategy to avoid this version in the future since it did get pulled. Thanks

  18. locked as resolved and limited conversation to collaborators on Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-testingtriage-needed

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions