安装 allure pytest 适配器后出错
Error after installation of allure pytest adaptor
我正在尝试在 Windows 8 框上使用 Pytest (3.6xx) 配置 Allure (2.6.0)。
我能够 运行 pytest 并生成 jUnit xml 报告文件,稍后我可以将其传递给 allure(allure 服务器 jUnitXmlFile.xml)并且它工作正常。
我需要的是 Allure 提供的附加功能(元数据、附件等),所以我下载了 pytest-allure-adaptor。
所以我在我的 venv 中安装了以下软件包:
allure-pytest==2.4.1
allure-python-commons==2.4.1
pytest-allure-adaptor==1.7.10
...
如果我现在 运行 py.test.exe,我会得到以下错误:
(venv) c:\TestAutomation>py.test.exe
Traceback (most recent call last):
File "C:\Tools\WinPython\python-3.6.5.amd64\Lib\runpy.py", line 193, in
_run_module_as_main
"__main__", mod_spec)
File "C:\Tools\WinPython\python-3.6.5.amd64\Lib\runpy.py", line 85, in
_run_code
exec(code, run_globals)
File "c:\TestAutomation\venv\Scripts\py.test.exe\__main__.py", line 9, in
<module>
File "c:\testautomation\venv\lib\site-packages\_pytest\config.py", line 52,
in main
config = _prepareconfig(args, plugins)
File "c:\testautomation\venv\lib\site-packages\_pytest\config.py", line
163, in _prepareconfig
pluginmanager=pluginmanager, args=args)
File "c:\testautomation\venv\lib\site-packages\pluggy\__init__.py", line
617, in __call__
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
File "c:\testautomation\venv\lib\site-packages\pluggy\__init__.py", line
222, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "c:\testautomation\venv\lib\site-packages\pluggy\__init__.py", line
216, in <lambda>
firstresult=hook.spec_opts.get('firstresult'),
File "c:\testautomation\venv\lib\site-packages\pluggy\callers.py", line
196, in _multicall
gen.send(outcome)
File "c:\testautomation\venv\lib\site-packages\_pytest\helpconfig.py", line
68, in pytest_cmdline_parse
config = outcome.get_result()
File "c:\testautomation\venv\lib\site-packages\pluggy\callers.py", line 76,
in get_result
raise ex[1].with_traceback(ex[2])
File "c:\testautomation\venv\lib\site-packages\pluggy\callers.py", line 180,
in _multicall
res = hook_impl.function(*args)
File "c:\testautomation\venv\lib\site-packages\_pytest\config.py", line
941, in pytest_cmdline_parse
self.parse(args)
File "c:\testautomation\venv\lib\site-packages\_pytest\config.py", line
1091, in parse
self._preparse(args, addopts=addopts)
File "c:\testautomation\venv\lib\site-packages\_pytest\config.py", line
1053, in _preparse
self.pluginmanager.load_setuptools_entrypoints('pytest11')
File "c:\testautomation\venv\lib\site-packages\pluggy\__init__.py", line
403, in load_setuptools_entrypoints
self.register(plugin, name=ep.name)
File "c:\testautomation\venv\lib\site-packages\_pytest\config.py", line
260, in register
ret = super(PytestPluginManager, self).register(plugin, name)
File "c:\testautomation\venv\lib\site-packages\pluggy\__init__.py", line
254, in register
hook._maybe_apply_history(hookimpl)
File "c:\testautomation\venv\lib\site-packages\pluggy\__init__.py", line
650, in _maybe_apply_history
res = self._hookexec(self, [method], kwargs)
File "c:\testautomation\venv\lib\site-packages\pluggy\__init__.py", line
222, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "c:\testautomation\venv\lib\site-packages\pluggy\__init__.py", line
216, in <lambda>
firstresult=hook.spec_opts.get('firstresult'),
File "c:\testautomation\venv\lib\site-packages\pluggy\callers.py", line
201, in _multicall
return outcome.get_result()
File "c:\testautomation\venv\lib\site-packages\pluggy\callers.py", line 76,
in get_result
raise ex[1].with_traceback(ex[2])
File "c:\testautomation\venv\lib\site-packages\pluggy\callers.py", line
180, in _multicall
res = hook_impl.function(*args)
File "c:\testautomation\venv\lib\site-packages\allure_pytest\plugin.py",
line 20, in pytest_addoption
help="Generate Allure report in the specified directory (may not exist)")
File "c:\testautomation\venv\lib\site-packages\_pytest\config.py", line
759, in addoption
raise ValueError("option names %s already added" % conflict)
ValueError: option names {'--alluredir'} already added
pytest-allure-adaptor 有问题吗?
有人有类似的问题吗?
allure-python-commons 与 pytest-allure-adaptor 不兼容。您需要删除旧插件并重新安装 allure-pytest 和 allure-python-commons.
你的 pytest-allure-adaptor 不兼容。如果您有 python2-
,则此 pip 命令只需要 运行
pip uninstall pytest-allure-adaptor
else 运行 这个命令如果你有 python3 -
pip3 uninstall pytest-allure-adaptor
我正在尝试在 Windows 8 框上使用 Pytest (3.6xx) 配置 Allure (2.6.0)。 我能够 运行 pytest 并生成 jUnit xml 报告文件,稍后我可以将其传递给 allure(allure 服务器 jUnitXmlFile.xml)并且它工作正常。
我需要的是 Allure 提供的附加功能(元数据、附件等),所以我下载了 pytest-allure-adaptor。
所以我在我的 venv 中安装了以下软件包:
allure-pytest==2.4.1
allure-python-commons==2.4.1
pytest-allure-adaptor==1.7.10
...
如果我现在 运行 py.test.exe,我会得到以下错误:
(venv) c:\TestAutomation>py.test.exe
Traceback (most recent call last):
File "C:\Tools\WinPython\python-3.6.5.amd64\Lib\runpy.py", line 193, in
_run_module_as_main
"__main__", mod_spec)
File "C:\Tools\WinPython\python-3.6.5.amd64\Lib\runpy.py", line 85, in
_run_code
exec(code, run_globals)
File "c:\TestAutomation\venv\Scripts\py.test.exe\__main__.py", line 9, in
<module>
File "c:\testautomation\venv\lib\site-packages\_pytest\config.py", line 52,
in main
config = _prepareconfig(args, plugins)
File "c:\testautomation\venv\lib\site-packages\_pytest\config.py", line
163, in _prepareconfig
pluginmanager=pluginmanager, args=args)
File "c:\testautomation\venv\lib\site-packages\pluggy\__init__.py", line
617, in __call__
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
File "c:\testautomation\venv\lib\site-packages\pluggy\__init__.py", line
222, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "c:\testautomation\venv\lib\site-packages\pluggy\__init__.py", line
216, in <lambda>
firstresult=hook.spec_opts.get('firstresult'),
File "c:\testautomation\venv\lib\site-packages\pluggy\callers.py", line
196, in _multicall
gen.send(outcome)
File "c:\testautomation\venv\lib\site-packages\_pytest\helpconfig.py", line
68, in pytest_cmdline_parse
config = outcome.get_result()
File "c:\testautomation\venv\lib\site-packages\pluggy\callers.py", line 76,
in get_result
raise ex[1].with_traceback(ex[2])
File "c:\testautomation\venv\lib\site-packages\pluggy\callers.py", line 180,
in _multicall
res = hook_impl.function(*args)
File "c:\testautomation\venv\lib\site-packages\_pytest\config.py", line
941, in pytest_cmdline_parse
self.parse(args)
File "c:\testautomation\venv\lib\site-packages\_pytest\config.py", line
1091, in parse
self._preparse(args, addopts=addopts)
File "c:\testautomation\venv\lib\site-packages\_pytest\config.py", line
1053, in _preparse
self.pluginmanager.load_setuptools_entrypoints('pytest11')
File "c:\testautomation\venv\lib\site-packages\pluggy\__init__.py", line
403, in load_setuptools_entrypoints
self.register(plugin, name=ep.name)
File "c:\testautomation\venv\lib\site-packages\_pytest\config.py", line
260, in register
ret = super(PytestPluginManager, self).register(plugin, name)
File "c:\testautomation\venv\lib\site-packages\pluggy\__init__.py", line
254, in register
hook._maybe_apply_history(hookimpl)
File "c:\testautomation\venv\lib\site-packages\pluggy\__init__.py", line
650, in _maybe_apply_history
res = self._hookexec(self, [method], kwargs)
File "c:\testautomation\venv\lib\site-packages\pluggy\__init__.py", line
222, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "c:\testautomation\venv\lib\site-packages\pluggy\__init__.py", line
216, in <lambda>
firstresult=hook.spec_opts.get('firstresult'),
File "c:\testautomation\venv\lib\site-packages\pluggy\callers.py", line
201, in _multicall
return outcome.get_result()
File "c:\testautomation\venv\lib\site-packages\pluggy\callers.py", line 76,
in get_result
raise ex[1].with_traceback(ex[2])
File "c:\testautomation\venv\lib\site-packages\pluggy\callers.py", line
180, in _multicall
res = hook_impl.function(*args)
File "c:\testautomation\venv\lib\site-packages\allure_pytest\plugin.py",
line 20, in pytest_addoption
help="Generate Allure report in the specified directory (may not exist)")
File "c:\testautomation\venv\lib\site-packages\_pytest\config.py", line
759, in addoption
raise ValueError("option names %s already added" % conflict)
ValueError: option names {'--alluredir'} already added
pytest-allure-adaptor 有问题吗? 有人有类似的问题吗?
allure-python-commons 与 pytest-allure-adaptor 不兼容。您需要删除旧插件并重新安装 allure-pytest 和 allure-python-commons.
你的 pytest-allure-adaptor 不兼容。如果您有 python2-
,则此 pip 命令只需要 运行pip uninstall pytest-allure-adaptor
else 运行 这个命令如果你有 python3 -
pip3 uninstall pytest-allure-adaptor