1. Background description
The colleague who tested last week said that the pytest+allure environment is no problem running on other people’s computers, but when running in her environment, an error was reported and asked for help. In fact, pytest has only heard of allure and never heard of it directly, but it can’t directly say that it won’t,
Look at the environment pytest can be installed directly in the form of a python library: pip install pytest pytest-allure-adaptor pytest-rerunfailures pytest-html
Allure installation is also simple to download and decompress and then add the bin directory to the environment variable. Download link: https://github.com/allure-framework/allure2/releases/tag/2.10.0
2. Problem solving
2.1 Error description
The main operating errors are as follows:
pluggy.manager.PluginValidationError: unknown hook'pytest_namespace' in plugin <module'allure.pytest_plugin' from'd:\\language\\miniconda3\\e nvs\\pytest\\lib\\site-packages\\allure\\pytest_plugin.py'>
The complete error is as follows:
F:\PycharmProjects\pytest>pytest ================================================== ================== test session starts =================================================================================================================================================================================================================================================================================== ======================================= platform win32 - Python 3.6.6, pytest-4.3.0, py-1.7.0, pluggy-0.8.1 rootdir: F:\PycharmProjects\pytest, inifile: pytest.ini plugins: rerunfailures-6.0, metadata-1.8.0, html-1.20.0, allure-adaptor-1.7.10 collecting 1 item I NTERNALERROR> Traceback (most recent call last): INTERNALERROR> File "d:\language\miniconda3\envs\pytest\lib\site-packages\_pytest\main.py", line 210, in wrap_session INTERNALERROR> session.exitstatus = doit(config, session) or 0 INTERNALERROR> File "d:\language\miniconda3\envs\pytest\lib\site-packages\_pytest\main.py", line 249, in _main INTERNALERROR> config.hook.pytest_collection(session=session) INTERNALERROR> File "d:\language\miniconda3\envs\pytest\lib\site-packages\pluggy\hooks.py", line 284, in __call__ INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs) INTERNALERROR> File "d:\language\miniconda3\envs\pytest\lib\site-packages\pluggy\manager.py", line 68, in _hookexec INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs) INTERNALERROR> File "d:\language\miniconda3\envs\pytest\lib\site-packages\pluggy\manager.py", line 62, in <lambda> INTERNALERROR> firstresult=hook.spec.opts.get("firstresult") if hook.spec else False, INTERNALERROR> File "d:\language\miniconda3\envs\pytest\lib\site-packages\pluggy\callers.py", line 208, in _multicall INTERNALERROR> return outcome.get_result() INTERNALERROR> File "d:\language\miniconda3\envs\pytest\lib\site-packages\pluggy\callers.py", line 80, in get_result INTERNALERROR> raise ex[1].with_traceback(ex[2]) INTERNALERROR> File "d:\language\miniconda3\envs\pytest\lib\site-packages\pluggy\callers.py", line 187, in _multicall INTERNALERROR> res = hook_impl.function(*args) INTERNALERROR> File "d:\language\miniconda3\envs\pytest\lib\site-packages\_pytest\main.py", line 259, in pytest_collection INTERNALERROR> return session.perform_collect() INTERNALERROR> File "d:\language\miniconda3\envs\pytest\lib\site-packages\_pytest\main.py", line 487, in perform_collect INTERNALERROR> self.config.pluginmanager.check_pending() INTERNALERROR> File "d:\language\miniconda3\envs\pytest\lib\site-packages\pluggy\manager.py", line 251, in check_pending INTERNALERROR>% (name, hookimpl.plugin), INTERNALERROR> pluggy.manager.PluginValidationError: unknown hook'pytest_namespace' in plugin <module'allure.pytest_plugin' from'd:\\language\\miniconda3\\e nvs\\pytest\\lib\\site-packages\\allure\\pytest_plugin.py'>
2.2 Error handling
Repeatedly re-created and configured the environment, and suddenly it ran successfully. I went back to rule out the Chinese path for the project, the Chinese path for the python environment, and the conda release. After I remembered that a page on Google said it was a version problem and I followed its recommendations. Old version installed:
Finally, it is confirmed that the new version of pytest (I am currently 4.3.0) reports an error, and it will not report an error if it is replaced with version 4.0.2:
# Uninstall the installed pytest pip uninstall pytest 4. Installation # 0 .2 version pytest pip install pytest== 4.0. 2
Successfully run as shown below:
Read More:
- Pytest AttributeError: module ‘pytest‘ has no attribute ‘main‘
- [Solved] Pytest Error: E ModuleNotFoundError: No module named ‘common
- [Solved] PyCharm pytest-html Install Error: Try to run this command from the system terminal. Make sure that you use
- [Solved] pytest error: error: unrecognized arguments
- [Solved] AttributeError: ‘Manager‘ object has no attribute ‘get_by_natural_key‘
- [Solved] with ERRTYPE = cudaError CUDA failure 999 unknown error
- [Solved] AttributeError: Manager isn‘t available; ‘auth.User‘ has been swapped for ‘
- Django Error: ‘polls‘ is not a registered namespace
- [Solved] Android studio Namespace ‘tools’ is not bound!
- [Solved] selenium.common.exceptions.WebDriverException: Message: unknown error: DevToolsActivePort file doesn
- How to Solve Error handling after upgrade pip of Anaconda
- Using Python error urlopen error unknown URL type: the solution of HTTPS
- [Solved] CUDA unknown error – this may be due to an incorrectly set up environment
- [Solved] unknown error: Chrome failed to start: exited abnormally (Driver info: chromedriver=2.36.540471
- Python: Django exception when executing migrate operation: django.db.utils.OperationalError: (1051, “Unknown table’xxx’”)
- [Solved] C error: expected 1 fields in line 3, saw 2 processing method
- [Solved] deepin python Message: unknown error: cannot find Chrome binary
- [Solved] Pylint Warning: An attribute defined in json.encoder line 158 hides this methodpylint(method-hidden)
- Python: The behavior of this method will change in future versions
- The Python DOM method iterates over all the XML in a folder