AttributeError: 'PytestPluginManager' object has no attribute 'addhooks'
See original GitHub issue‘addhooks’ attribute of PytestPluginManager is removed at pytest 5.0.0.
Because of this, add_hookspecs = getattr(pluginmanager, 'add_hookspecs', pluginmanager.addhooks)
does not work (#16). It occur following error.
Traceback (most recent call last):
File "/Users/ohing/.virtualenvs/django-drf-project-template-Kk8KycnX/bin/pytest", line 10, in <module>
sys.exit(main())
File "/Users/ohing/.virtualenvs/django-drf-project-template-Kk8KycnX/lib/python3.7/site-packages/_pytest/config/__init__.py", line 55, in main
config = _prepareconfig(args, plugins)
File "/Users/ohing/.virtualenvs/django-drf-project-template-Kk8KycnX/lib/python3.7/site-packages/_pytest/config/__init__.py", line 200, in _prepareconfig
pluginmanager=pluginmanager, args=args
File "/Users/ohing/.virtualenvs/django-drf-project-template-Kk8KycnX/lib/python3.7/site-packages/pluggy/hooks.py", line 289, in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "/Users/ohing/.virtualenvs/django-drf-project-template-Kk8KycnX/lib/python3.7/site-packages/pluggy/manager.py", line 87, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/Users/ohing/.virtualenvs/django-drf-project-template-Kk8KycnX/lib/python3.7/site-packages/pluggy/manager.py", line 81, in <lambda>
firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
File "/Users/ohing/.virtualenvs/django-drf-project-template-Kk8KycnX/lib/python3.7/site-packages/pluggy/callers.py", line 203, in _multicall
gen.send(outcome)
File "/Users/ohing/.virtualenvs/django-drf-project-template-Kk8KycnX/lib/python3.7/site-packages/_pytest/helpconfig.py", line 89, in pytest_cmdline_parse
config = outcome.get_result()
File "/Users/ohing/.virtualenvs/django-drf-project-template-Kk8KycnX/lib/python3.7/site-packages/pluggy/callers.py", line 80, in get_result
raise ex[1].with_traceback(ex[2])
File "/Users/ohing/.virtualenvs/django-drf-project-template-Kk8KycnX/lib/python3.7/site-packages/pluggy/callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "/Users/ohing/.virtualenvs/django-drf-project-template-Kk8KycnX/lib/python3.7/site-packages/_pytest/config/__init__.py", line 661, in pytest_cmdline_parse
self.parse(args)
File "/Users/ohing/.virtualenvs/django-drf-project-template-Kk8KycnX/lib/python3.7/site-packages/_pytest/config/__init__.py", line 869, in parse
self._preparse(args, addopts=addopts)
File "/Users/ohing/.virtualenvs/django-drf-project-template-Kk8KycnX/lib/python3.7/site-packages/_pytest/config/__init__.py", line 815, in _preparse
self.pluginmanager.load_setuptools_entrypoints("pytest11")
File "/Users/ohing/.virtualenvs/django-drf-project-template-Kk8KycnX/lib/python3.7/site-packages/pluggy/manager.py", line 293, in load_setuptools_entrypoints
self.register(plugin, name=ep.name)
File "/Users/ohing/.virtualenvs/django-drf-project-template-Kk8KycnX/lib/python3.7/site-packages/_pytest/config/__init__.py", line 302, in register
ret = super().register(plugin, name)
File "/Users/ohing/.virtualenvs/django-drf-project-template-Kk8KycnX/lib/python3.7/site-packages/pluggy/manager.py", line 121, in register
hook._maybe_apply_history(hookimpl)
File "/Users/ohing/.virtualenvs/django-drf-project-template-Kk8KycnX/lib/python3.7/site-packages/pluggy/hooks.py", line 336, in _maybe_apply_history
res = self._hookexec(self, [method], kwargs)
File "/Users/ohing/.virtualenvs/django-drf-project-template-Kk8KycnX/lib/python3.7/site-packages/pluggy/manager.py", line 87, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/Users/ohing/.virtualenvs/django-drf-project-template-Kk8KycnX/lib/python3.7/site-packages/pluggy/manager.py", line 81, in <lambda>
firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
File "/Users/ohing/.virtualenvs/django-drf-project-template-Kk8KycnX/lib/python3.7/site-packages/pluggy/callers.py", line 208, in _multicall
return outcome.get_result()
File "/Users/ohing/.virtualenvs/django-drf-project-template-Kk8KycnX/lib/python3.7/site-packages/pluggy/callers.py", line 80, in get_result
raise ex[1].with_traceback(ex[2])
File "/Users/ohing/.virtualenvs/django-drf-project-template-Kk8KycnX/lib/python3.7/site-packages/pluggy/callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "/Users/ohing/.virtualenvs/django-drf-project-template-Kk8KycnX/lib/python3.7/site-packages/pytest_factoryboy/plugin.py", line 117, in pytest_addhooks
add_hookspecs = getattr(pluginmanager, 'add_hookspecs', pluginmanager.addhooks)
AttributeError: 'PytestPluginManager' object has no attribute 'addhooks'
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:5 (1 by maintainers)
Top Results From Across the Web
【Python】AttributeError: 'PytestPluginManager' object has no ...
【Python】AttributeError: 'PytestPluginManager' object has no attribute 'addhooks' / pytest-html. 目录. 一、报错; 二、解决. 回到顶部 ...
Read more >_pytest.config — pytest documentation
PytestPluginManager `, with default plugins already loaded. This function can be used by integration with other tools, like hooking into pytest to run...
Read more >python - In PyTest how to config CaptureManager plugin error ...
'CaptureManager' object has no attribute 'suspendcapture'. That's true. The methods are now called "global": start_global_capturing ...
Read more >Changelog — pytest documentation
#8990: Fix pytest -vv crashing with an internal exception AttributeError: 'str' object has no attribute 'relative_to' in some cases.
Read more >config.py
PytestPluginManager `, with default plugins already loaded. ... The returned group object has an ``addoption`` method with the same signature as ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed in #80. New release 2.0.3 is already available on pypi.
pls merge/release soon!