allankp / pytest-testrail

pytest plugin for integration with TestRail, for creating testruns and updating results
MIT License
95 stars 125 forks source link

v2.8.0 tc-custom-comment carshes pytest #114

Closed zeburek closed 4 years ago

zeburek commented 4 years ago

Describe the bug After 2.8.0 --tc-custom-comment crashes pytest

To Reproduce Steps to reproduce the behavior:

  1. Start any test with pytest >= 2.8.0

Expected behavior Tests goes

Screenshots

INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/builds/emm/tests/.tox/py3/lib/python3.6/site-packages/_pytest/config/__init__.py", line 1050, in getoption
INTERNALERROR>     val = getattr(self.option, name)
INTERNALERROR> AttributeError: 'Namespace' object has no attribute '----tc-custom-comment'
INTERNALERROR> 
INTERNALERROR> During handling of the above exception, another exception occurred:
INTERNALERROR> 
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/builds/emm/tests/.tox/py3/lib/python3.6/site-packages/_pytest/main.py", line 187, in wrap_session
INTERNALERROR>     config._do_configure()
INTERNALERROR>   File "/builds/emm/tests/.tox/py3/lib/python3.6/site-packages/_pytest/config/__init__.py", line 720, in _do_configure
INTERNALERROR>     self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
INTERNALERROR>   File "/builds/emm/tests/.tox/py3/lib/python3.6/site-packages/pluggy/hooks.py", line 308, in call_historic
INTERNALERROR>     res = self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "/builds/emm/tests/.tox/py3/lib/python3.6/site-packages/pluggy/manager.py", line 92, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/builds/emm/tests/.tox/py3/lib/python3.6/site-packages/pluggy/manager.py", line 86, in <lambda>
INTERNALERROR>     firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR>   File "/builds/emm/tests/.tox/py3/lib/python3.6/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/builds/emm/tests/.tox/py3/lib/python3.6/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/builds/emm/tests/.tox/py3/lib/python3.6/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/builds/emm/tests/.tox/py3/lib/python3.6/site-packages/pytest_testrail/conftest.py", line 151, in pytest_configure
INTERNALERROR>     custom_comment=config_manager.getoption('--tc-custom-comment', 'custom_comment', 'TESTCASE')
INTERNALERROR>   File "/builds/emm/tests/.tox/py3/lib/python3.6/site-packages/pytest_testrail/conftest.py", line 180, in getoption
INTERNALERROR>     value = self.config.getoption('--{}'.format(flag))
INTERNALERROR>   File "/builds/emm/tests/.tox/py3/lib/python3.6/site-packages/_pytest/config/__init__.py", line 1061, in getoption
INTERNALERROR>     raise ValueError("no option named {!r}".format(name))
INTERNALERROR> ValueError: no option named '----tc-custom-comment'

Here is wrong usage of getoption: https://github.com/allankp/pytest-testrail/blob/master/pytest_testrail/conftest.py#L151

allankp commented 4 years ago

@zeburek Thanks for flagging this up i'll take a look. (updated the title of this issue). v2.7.1 is OK