Closed kevin-henry-fernride closed 2 years ago
@kevin-henry-fernride I'm not getting how you try to use Report Portal with pytest and why you don't have such field. Because this field is initialized by pytest and I don't see any ways how you might skip it, except some hacky ways. A recommended way to use pytest was represented in our examples: https://github.com/reportportal/examples-python/tree/master/pytest
Anyway the fix looks simple, it's just an attribute check, so I approved it.
name: Bug report about: Create a report to help us improve title: '' labels: bug assignees: ''
Describe the bug I am running launch_test through pytest call to use reportportal. Unfortunately the launch_testing.pytest.hooks.LaunchTestItem has no .obj attribute, which raises an exception at pytest_reportportal/service.py line 714
1: INTERNALERROR> Traceback (most recent call last): 1: INTERNALERROR> File "/usr/lib/python3/dist-packages/_pytest/main.py", line 206, in wrap_session 1: INTERNALERROR> session.exitstatus = doit(config, session) or 0 1: INTERNALERROR> File "/usr/lib/python3/dist-packages/_pytest/main.py", line 250, in _main 1: INTERNALERROR> config.hook.pytest_runtestloop(session=session) 1: INTERNALERROR> File "/usr/lib/python3/dist-packages/pluggy/hooks.py", line 286, in call 1: INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs) 1: INTERNALERROR> File "/usr/lib/python3/dist-packages/pluggy/manager.py", line 92, in _hookexec 1: INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs) 1: INTERNALERROR> File "/usr/lib/python3/dist-packages/pluggy/manager.py", line 83, in
1: INTERNALERROR> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
1: INTERNALERROR> File "/usr/lib/python3/dist-packages/pluggy/callers.py", line 208, in _multicall
1: INTERNALERROR> return outcome.get_result()
1: INTERNALERROR> File "/usr/lib/python3/dist-packages/pluggy/callers.py", line 80, in get_result
1: INTERNALERROR> raise ex[1].with_traceback(ex[2])
1: INTERNALERROR> File "/usr/lib/python3/dist-packages/pluggy/callers.py", line 187, in _multicall
1: INTERNALERROR> res = hook_impl.function(*args)
1: INTERNALERROR> File "/usr/lib/python3/dist-packages/_pytest/main.py", line 271, in pytest_runtestloop
1: INTERNALERROR> item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
1: INTERNALERROR> File "/usr/lib/python3/dist-packages/pluggy/hooks.py", line 286, in call
1: INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)
1: INTERNALERROR> File "/usr/lib/python3/dist-packages/pluggy/manager.py", line 92, in _hookexec
1: INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
1: INTERNALERROR> File "/usr/lib/python3/dist-packages/pluggy/manager.py", line 83, in
1: INTERNALERROR> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
1: INTERNALERROR> File "/usr/lib/python3/dist-packages/pluggy/callers.py", line 208, in _multicall
1: INTERNALERROR> return outcome.get_result()
1: INTERNALERROR> File "/usr/lib/python3/dist-packages/pluggy/callers.py", line 80, in get_result
1: INTERNALERROR> raise ex[1].with_traceback(ex[2])
1: INTERNALERROR> File "/usr/lib/python3/dist-packages/pluggy/callers.py", line 182, in _multicall
1: INTERNALERROR> next(gen) # first yield
1: INTERNALERROR> File "/home/khenry/.local/lib/python3.8/site-packages/pytest_reportportal/listener.py", line 55, in pytest_runtest_protocol
1: INTERNALERROR> item_id = self.py_test_service.start_pytest_item(item)
1: INTERNALERROR> File "/home/khenry/.local/lib/python3.8/site-packages/pytest_reportportal/service.py", line 328, in start_pytest_item
1: INTERNALERROR> 'description': self._get_item_description(test_item),
1: INTERNALERROR> File "/home/khenry/.local/lib/python3.8/site-packages/pytest_reportportal/service.py", line 714, in _get_item_description
1: INTERNALERROR> doc = test_item.obj.doc
1: INTERNALERROR> AttributeError: 'LaunchTestItem' object has no attribute 'obj'
1
And this is my TestItem: 1: TEST ITEM 1: <class 'launch_testing.pytest.hooks.LaunchTestItem'> 1: {'name': 'test_exitcodes_generic_nodes', 'parent': <LaunchTestModule tests/general/integration/test_exitcodes_generic_nodes.py>, 'config': <_pytest.config.Config object at 0x7f521068bbb0>, 'session':, 'fspath': local('/home/khenry/talos/src/talos_data2/tests/general/integration/test_exitcodes_generic_nodes.py'), 'keywords': <NodeKeywords for node >, 'own_markers': [], 'extra_keyword_matches': set(), '_name2pseudofixturedef': {}, '_nodeid': 'tests/general/integration/test_exitcodes_generic_nodes.py::test_exitcodes_generic_nodes', '_report_sections': [], 'user_properties': [], 'test_runs': [<launch_testing.loader.TestRun object at 0x7f520d494c70>], 'runner_cls': <class 'launch_testing.test_runner.LaunchTestRunner'>, '_rp_name': 'tests/general/integration::test_exitcodes_generic_nodes'}
Steps to Reproduce Steps to reproduce the behavior:
Expected behavior A clear and concise description of what you expected to happen.
Actual behavior What actually happened.
Package versions Include version info of the following packages: reportportal-client, pytest-reportportal Name: pytest-reportportal Version: 5.0.10
Additional context Add any other context about the problem here.