Repository navigation
Closed
Labels
Description
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:
- Install python extension v2024.9.2024062601
- Install pytest python module pytest==7.1.2 and pluggy==1.0.0
- 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.languageServersetting: 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
Reacted by tthornton3-chwy, Jack Paine, Tali von Huth, Alessio Lombardi, Jack B., Cruz, ivanyovz, Emiliano Jordan, Shane Wetherington, Jeff Weimer and 15 more
Activity
eleanorjboyd commentedon Jun 26, 2024
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
somenewacc commentedon Jun 26, 2024
Eleanor Boyd (@eleanorjboyd), hi.
idk about it, this version is used on my project.
no option for backwards compatibility?
DetachHead commentedon Jun 28, 2024
when i added this hook in #23539 i tried using the old
hookwrapperargument instead of the newwrapperone 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?
eleanorjboyd commentedon Jul 1, 2024
DetachHead and somenewacc, yes lets do something for backwards compatibility, I will investigate
eleanorjboyd commentedon Jul 1, 2024
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? Thankssomenewacc commentedon Jul 2, 2024
Eleanor Boyd (@eleanorjboyd) hi!
I'm on WSL Ubuntu 22.04 (Linux x64 5.15.153.1-microsoft-standard-WSL2).
I created simple project:
venv with Python 3.10.12:

Installed pytest==7.1.2 and after that pluggy==1.0.0:
.vscode/settings.json):{ "python.testing.pytestArgs": [ "." ], "python.testing.unittestEnabled": false, "python.testing.pytestEnabled": true }Run "Refresh Tests":

Got error:

Python extension version: v2024.9.2024062703 (pre-release)
Hope that helps!
TomskDiver commentedon Jul 9, 2024
Got same error. On VSCode
works fine.
But autoupdate to
and got error with pytest.
TomskDiver commentedon Jul 9, 2024
Maybe breaking change is here: https://github.com/microsoft/vscode-python/pull/23539/files#diff-9a28b4b19fbb6331c15c76b4752852162785c0d521038cb637d8432901ebead2R896
TomskDiver commentedon Jul 9, 2024
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
wrapperparameter, but have oldhookwrapper.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/)sihcpro commentedon Jul 15, 2024
I fixed it by run this command:
pip install --upgrade pytestjuancrod commentedon Jul 15, 2024
This works for me too. Thank you!
eleanorjboyd commentedon Jul 15, 2024
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