reportportal / agent-python-pytest

Framework integration with PyTest
Apache License 2.0
94 stars 102 forks source link

AttributeError: 'Namespace' object has no attribute 'rp_ignore_errors' #273

Closed rthardin closed 3 years ago

rthardin commented 3 years ago

name: Bug report about: Create a report to help us improve title: 'AttributeError: 'Namespace' object has no attribute 'rp_ignore_errors'' labels: bug assignees: ''


Describe the bug My recent PR https://github.com/reportportal/agent-python-pytest/pull/271 has caused plugin initialization to fail in the master branch:

pytest --reportportal --verbose -ra ...
...    
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/Users/ryan.hardin/Workspaces/xray/server/.env/lib/python3.9/site-packages/_pytest/main.py", line 265, in wrap_session
INTERNALERROR>     config._do_configure()
INTERNALERROR>   File "/Users/ryan.hardin/Workspaces/xray/server/.env/lib/python3.9/site-packages/_pytest/config/__init__.py", line 982, in _do_configure
INTERNALERROR>     self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
INTERNALERROR>   File "/Users/ryan.hardin/Workspaces/xray/server/.env/lib/python3.9/site-packages/pluggy/hooks.py", line 308, in call_historic
INTERNALERROR>     res = self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "/Users/ryan.hardin/Workspaces/xray/server/.env/lib/python3.9/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/Users/ryan.hardin/Workspaces/xray/server/.env/lib/python3.9/site-packages/pluggy/manager.py", line 84, in <lambda>
INTERNALERROR>     self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR>   File "/Users/ryan.hardin/Workspaces/xray/server/.env/lib/python3.9/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/Users/ryan.hardin/Workspaces/xray/server/.env/lib/python3.9/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/Users/ryan.hardin/Workspaces/xray/server/.env/lib/python3.9/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/Users/ryan.hardin/Workspaces/xray/server/.env/lib/python3.9/site-packages/pytest_reportportal/plugin.py", line 164, in pytest_configure
INTERNALERROR>     agent_config = AgentConfig(config)
INTERNALERROR>   File "/Users/ryan.hardin/Workspaces/xray/server/.env/lib/python3.9/site-packages/pytest_reportportal/config.py", line 22, in __init__
INTERNALERROR>     self.rp_ignore_errors = self.find_option('rp_ignore_errors')
INTERNALERROR>   File "/Users/ryan.hardin/Workspaces/xray/server/.env/lib/python3.9/site-packages/pytest_reportportal/config.py", line 65, in find_option
INTERNALERROR>     getattr(self.pconfig.option, option_name) or
INTERNALERROR> AttributeError: 'Namespace' object has no attribute 'rp_ignore_errors'
make: *** [test-reportportal] Error 3

Steps to Reproduce Steps to reproduce the behavior:

  1. Run pytest --reportportal in a pytest-enabled project using the latest master build.

Expected behavior pytest should run to completion.

Actual behavior pytest fails to start.

Package versions pytest-reportportal: 40e314c08b6714dcdef1884a113b65865514da17 reportportal-client: 5.0.12

Additional context The issue is caused by a missing default value on line 65 of config.py. This line:

getattr(self.pconfig.option, option_name) or

should be replaced by this line:

getattr(self.pconfig.option, option_name, None) or