allure-framework / allure-framework/allure-python

allure-pytest-bdd encounters ValueError: option names {'--alluredir'} already added

Đang mở
#486 7 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug theme:pytest-bdd
Ngôn ngữ chính
Python
Star
814
Fork
260
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

I'm writing test cases with pytest-bdd and need allure reports with gherkin steps, but the report can't be generated properly.

**Version info**
> allure-pytest 2.8.13
allure-pytest-bdd 2.8.13
allure-python-commons 2.8.13
pytest 5.4.1
pytest-bdd 3.3.0

**pytest.ini**
> [pytest]
addopts = -vv --alluredir alluredir --clean-alluredir

Before allure-pytest-bdd is installed, test cases can run with following command line.
> pytest step_defs\test_PayInfo.py

When allure-pytest-bdd is installed, I see error msg like

> Traceback (most recent call last):
File "c:\python3\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\python3\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Python3\Scripts\pytest.exe\__main__.py", line 7, in
File "c:\python3\lib\site-packages\_pytest\config\__init__.py", line 105, in main
config = _prepareconfig(args, plugins)
File "c:\python3\lib\site-packages\_pytest\config\__init__.py", line 258, in _prepareconfig
pluginmanager=pluginmanager, args=args
File "c:\python3\lib\site-packages\pluggy\hooks.py", line 289, in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "c:\python3\lib\site-packages\pluggy\manager.py", line 87, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "c:\python3\lib\site-packages\pluggy\manager.py", line 81, in
firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
File "c:\python3\lib\site-packages\pluggy\callers.py", line 203, in _multicall
gen.send(outcome)
File "c:\python3\lib\site-packages\_pytest\helpconfig.py", line 90, in pytest_cmdline_parse
config = outcome.get_result()
File "c:\python3\lib\site-packages\pluggy\callers.py", line 80, in get_result
raise ex[1].with_traceback(ex[2])
File "c:\python3\lib\site-packages\pluggy\callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "c:\python3\lib\site-packages\_pytest\config\__init__.py", line 836, in pytest_cmdline_parse
self.parse(args)
File "c:\python3\lib\site-packages\_pytest\config\__init__.py", line 1044, in parse
self._preparse(args, addopts=addopts)
File "c:\python3\lib\site-packages\_pytest\config\__init__.py", line 992, in _preparse
self.pluginmanager.load_setuptools_entrypoints("pytest11")
File "c:\python3\lib\site-packages\pluggy\manager.py", line 293, in load_setuptools_entrypoints
self.register(plugin, name=ep.name)
File "c:\python3\lib\site-packages\_pytest\config\__init__.py", line 379, in register
ret = super().register(plugin, name)
File "c:\python3\lib\site-packages\pluggy\manager.py", line 121, in register
hook._maybe_apply_history(hookimpl)
File "c:\python3\lib\site-packages\pluggy\hooks.py", line 336, in _maybe_apply_history
res = self._hookexec(self, [method], kwargs)
File "c:\python3\lib\site-packages\pluggy\manager.py", line 87, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "c:\python3\lib\site-packages\pluggy\manager.py", line 81, in
firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
File "c:\python3\lib\site-packages\pluggy\callers.py", line 208, in _multicall
return outcome.get_result()
File "c:\python3\lib\site-packages\pluggy\callers.py", line 80, in get_result
raise ex[1].with_traceback(ex[2])
File "c:\python3\lib\site-packages\pluggy\callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "c:\python3\lib\site-packages\allure_pytest_bdd\plugin.py", line 13, in pytest_addoption
help="Generate Allure report in the specified directory (may not exist)")
File "c:\python3\lib\site-packages\_pytest\config\argparsing.py", line 353, in addoption
raise ValueError("option names %s already added" % conflict)
ValueError: option names {'--alluredir'} already added

Even if I remove --alluredir alluredir, it can't be solved.

Does anyone know how to resolve it? Thank you!

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Start with allure_pytest_bdd/plugin.py at pytest_addoption, then compare how allure-pytest registers the --alluredir option. Reproduce the conflict with the versions and pytest.ini shown, including a run without --alluredir. Done means pytest starts without the duplicate-option ValueError while Allure reporting remains available.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
testing
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
38/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.