結論から言えば、使っているpytestがv6と古かったのでv8にアップデートすることで解決しました。
何があったか
いつも通りpytestをVSCode上から動かそうとしたら、以下のようなエラーメッセージが出て実行できなくなった。
2024-07-12 14:47:16.135 [error] Traceback (most recent call last):
File "/Users/[username]/.anyenv/envs/pyenv/versions/3.8.0/lib/python3.8/runpy.py", line 192, in _run_module_as_main
2024-07-12 14:47:16.176 [error] return _run_code(code, main_globals, None,
File "/Users/[username]/.anyenv/envs/pyenv/versions/3.8.0/lib/python3.8/runpy.py", line 85, in _run_code
2024-07-12 14:47:16.186 [error] exec(code, run_globals)
File "/Users/[username]/Library/Caches/pypoetry/virtualenvs/hoge-RkQYe53c-py3.8/lib/python3.8/site-packages/pytest/__main__.py", line 5, in <module>
raise SystemExit(pytest.console_main())
File "/Users/[username]/Library/Caches/pypoetry/virtualenvs/hoge-RkQYe53c-py3.8/lib/python3.8/site-packages/_pytest/config/__init__.py", line 185, in console_main
2024-07-12 14:47:16.232 [error] code = main()
File "/Users/[username]/Library/Caches/pypoetry/virtualenvs/hoge-RkQYe53c-py3.8/lib/python3.8/site-packages/_pytest/config/__init__.py", line 143, in main
2024-07-12 14:47:16.233 [error] config = _prepareconfig(args, plugins)
File "/Users/[username]/Library/Caches/pypoetry/virtualenvs/hoge-RkQYe53c-py3.8/lib/python3.8/site-packages/_pytest/config/__init__.py", line 318, in _prepareconfig
2024-07-12 14:47:16.233 [error] config = pluginmanager.hook.pytest_cmdline_parse(
File "/Users/[username]/Library/Caches/pypoetry/virtualenvs/hoge-RkQYe53c-py3.8/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
2024-07-12 14:47:16.274 [error] return self._hookexec(self, self.get_hookimpls(), kwargs)
File "/Users/[username]/Library/Caches/pypoetry/virtualenvs/hoge-RkQYe53c-py3.8/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
2024-07-12 14:47:16.283 [error] return self._inner_hookexec(hook, methods, kwargs)
File "/Users/[username]/Library/Caches/pypoetry/virtualenvs/hoge-RkQYe53c-py3.8/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
2024-07-12 14:47:16.283 [error] self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
File "/Users/[username]/Library/Caches/pypoetry/virtualenvs/hoge-RkQYe53c-py3.8/lib/python3.8/site-packages/pluggy/callers.py", line 203, in _multicall
2024-07-12 14:47:16.324 [error] gen.send(outcome)
File "/Users/[username]/Library/Caches/pypoetry/virtualenvs/hoge-RkQYe53c-py3.8/lib/python3.8/site-packages/_pytest/helpconfig.py", line 100, in pytest_cmdline_parse
2024-07-12 14:47:16.328 [error] config: Config = outcome.get_result()
File "/Users/[username]/Library/Caches/pypoetry/virtualenvs/hoge-RkQYe53c-py3.8/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
2024-07-12 14:47:16.328 [error] raise ex[1].with_traceback(ex[2])
File "/Users/[username]/Library/Caches/pypoetry/virtualenvs/hoge-RkQYe53c-py3.8/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
2024-07-12 14:47:16.328 [error] res = hook_impl.function(*args)
File "/Users/[username]/Library/Caches/pypoetry/virtualenvs/hoge-RkQYe53c-py3.8/lib/python3.8/site-packages/_pytest/config/__init__.py", line 1003, in pytest_cmdline_parse
2024-07-12 14:47:16.328 [error] self.parse(args)
File "/Users/[username]/Library/Caches/pypoetry/virtualenvs/hoge-RkQYe53c-py3.8/lib/python3.8/site-packages/_pytest/config/__init__.py", line 1283, in parse
2024-07-12 14:47:16.329 [error] self._preparse(args, addopts=addopts)
File "/Users/[username]/Library/Caches/pypoetry/virtualenvs/hoge-RkQYe53c-py3.8/lib/python3.8/site-packages/_pytest/config/__init__.py", line 1168, in _preparse
2024-07-12 14:47:16.329 [error] self.pluginmanager.consider_preparse(args, exclude_only=False)
File "/Users/[username]/Library/Caches/pypoetry/virtualenvs/hoge-RkQYe53c-py3.8/lib/python3.8/site-packages/_pytest/config/__init__.py", line 635, in consider_preparse
2024-07-12 14:47:16.329 [error] self.consider_pluginarg(parg)
File "/Users/[username]/Library/Caches/pypoetry/virtualenvs/hoge-RkQYe53c-py3.8/lib/python3.8/site-packages/_pytest/config/__init__.py", line 660, in consider_pluginarg
2024-07-12 14:47:16.330 [error] self.import_plugin(arg, consider_entry_points=True)
File "/Users/[username]/Library/Caches/pypoetry/virtualenvs/hoge-RkQYe53c-py3.8/lib/python3.8/site-packages/_pytest/config/__init__.py", line 703, in import_plugin
2024-07-12 14:47:16.330 [error] __import__(importspec)
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
2024-07-12 14:47:16.330 [error] File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
2024-07-12 14:47:16.330 [error] File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
2024-07-12 14:47:16.331 [error] File "/Users/[username]/Library/Caches/pypoetry/virtualenvs/hoge-RkQYe53c-py3.8/lib/python3.8/site-packages/_pytest/assertion/rewrite.py", line 170, in exec_module
2024-07-12 14:47:16.338 [error] exec(co, module.__dict__)
File "/Users/[username]/.vscode/extensions/ms-python.python-2024.10.0-darwin-x64/python_files/vscode_pytest/__init__.py", line 895, in <module>
2024-07-12 14:47:16.383 [error] class DeferPlugin:
File "/Users/[username]/.vscode/extensions/ms-python.python-2024.10.0-darwin-x64/python_files/vscode_pytest/__init__.py", line 896, in DeferPlugin
2024-07-12 14:47:16.383 [error] @pytest.hookimpl(wrapper=True)
TypeError
2024-07-12 14:47:16.383 [error] : __call__() got an unexpected keyword argument 'wrapper'
VSCodeのpython拡張機能が呼び出している関数に許容できない引数があるようです。
何をしたか
このプロジェクトはpoetryで管理していたので、以下のコマンドを実行してpytestをアップデートしました。
poetry add -D pytest@8.2.1
まとめ
v6の最新バージョンが2021/8とかなので、めちゃくちゃ古い状態のを使っていました。。
ライブラリはちょこちょこアップデートしないと。。