Repository: red-hat-storage/ocs-ci
Issue: AttributeError: 'CollectReport' object has no attribute 'description'

Test execution with enabled html reporting is failing with long traceback on
error `AttributeError: 'CollectReport' object has no attribute 'description'`.

The real issue is hidden behind this error and is related to #404 and #405.

```
+ run-ci tests/ -m tier1 -k '' --ocsci-conf /home/jenkins/current-cluster-dir/ocsci_conf.yaml --cluster-name jenkins-tier1 --cluster-path /home/jenkins/current-cluster-dir/openshift-cluster-dir --junit-xml /home/jenkins/current-cluster-dir/logs/test_results.xml -o junit_suite_name=jenkins-tier1 '--html=~/current-cluster-dir/logs/test_report.html' --self-contained-html --bugzilla --email=ocs-ci@redhat.com
Collecting Cluster versions
============================= test session starts ==============================
platform linux -- Python 3.6.8, pytest-5.0.1, py-1.8.0, pluggy-0.12.0
rootdir: /home/jenkins/workspace/qe-deploy-ocs-cluster/ocs-ci, inifile: pytest.ini
plugins: reportportal-1.0.5, logger-0.5.0, metadata-1.8.0, html-1.21.1, marker-bugzilla-0.9.1.dev2
collected 22 items / 1 errors / 21 selected
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/home/jenkins/workspace/qe-deploy-ocs-cluster/ocs-ci/venv/lib/python3.6/site-packages/_pytest/main.py", line 213, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "/home/jenkins/workspace/qe-deploy-ocs-cluster/ocs-ci/venv/lib/python3.6/site-packages/_pytest/main.py", line 256, in _main
INTERNALERROR>     config.hook.pytest_collection(session=session)
INTERNALERROR>   File "/home/jenkins/workspace/qe-deploy-ocs-cluster/ocs-ci/venv/lib/python3.6/site-packages/pluggy/hooks.py", line 289, in __call__
INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "/home/jenkins/workspace/qe-deploy-ocs-cluster/ocs-ci/venv/lib/python3.6/site-packages/pluggy/manager.py", line 87, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/home/jenkins/workspace/qe-deploy-ocs-cluster/ocs-ci/venv/lib/python3.6/site-packages/pluggy/manager.py", line 81, in <lambda>
INTERNALERROR>     firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR>   File "/home/jenkins/workspace/qe-deploy-ocs-cluster/ocs-ci/venv/lib/python3.6/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/home/jenkins/workspace/qe-deploy-ocs-cluster/ocs-ci/venv/lib/python3.6/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/home/jenkins/workspace/qe-deploy-ocs-cluster/ocs-ci/venv/lib/python3.6/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/home/jenkins/workspace/qe-deploy-ocs-cluster/ocs-ci/venv/lib/python3.6/site-packages/_pytest/main.py", line 266, in pytest_collection
INTERNALERROR>     return session.perform_collect()
INTERNALERROR>   File "/home/jenkins/workspace/qe-deploy-ocs-cluster/ocs-ci/venv/lib/python3.6/site-packages/_pytest/main.py", line 459, in perform_collect
INTERNALERROR>     items = self._perform_collect(args, genitems)
INTERNALERROR>   File "/home/jenkins/workspace/qe-deploy-ocs-cluster/ocs-ci/venv/lib/python3.6/site-packages/_pytest/main.py", line 498, in _perform_collect
INTERNALERROR>     self.items.extend(self.genitems(node))
INTERNALERROR>   File "/home/jenkins/workspace/qe-deploy-ocs-cluster/ocs-ci/venv/lib/python3.6/site-packages/_pytest/main.py", line 720, in genitems
INTERNALERROR>     yield from self.genitems(subnode)
INTERNALERROR>   File "/home/jenkins/workspace/qe-deploy-ocs-cluster/ocs-ci/venv/lib/python3.6/site-packages/_pytest/main.py", line 721, in genitems
INTERNALERROR>     node.ihook.pytest_collectreport(report=rep)
INTERNALERROR>   File "/home/jenkins/workspace/qe-deploy-ocs-cluster/ocs-ci/venv/lib/python3.6/site-packages/pluggy/hooks.py", line 289, in __call__
INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "/home/jenkins/workspace/qe-deploy-ocs-cluster/ocs-ci/venv/lib/python3.6/site-packages/pluggy/manager.py", line 87, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/home/jenkins/workspace/qe-deploy-ocs-cluster/ocs-ci/venv/lib/python3.6/site-packages/pluggy/manager.py", line 81, in <lambda>
INTERNALERROR>     firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR>   File "/home/jenkins/workspace/qe-deploy-ocs-cluster/ocs-ci/venv/lib/python3.6/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/home/jenkins/workspace/qe-deploy-ocs-cluster/ocs-ci/venv/lib/python3.6/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/home/jenkins/workspace/qe-deploy-ocs-cluster/ocs-ci/venv/lib/python3.6/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/home/jenkins/workspace/qe-deploy-ocs-cluster/ocs-ci/venv/lib/python3.6/site-packages/pytest_html/plugin.py", line 519, in pytest_collectreport
INTERNALERROR>     self.append_failed(report)
INTERNALERROR>   File "/home/jenkins/workspace/qe-deploy-ocs-cluster/ocs-ci/venv/lib/python3.6/site-packages/pytest_html/plugin.py", line 304, in append_failed
INTERNALERROR>     self._appendrow('Error', report)
INTERNALERROR>   File "/home/jenkins/workspace/qe-deploy-ocs-cluster/ocs-ci/venv/lib/python3.6/site-packages/pytest_html/plugin.py", line 273, in _appendrow
INTERNALERROR>     result = self.TestResult(outcome, report, self.logfile, self.config)
INTERNALERROR>   File "/home/jenkins/workspace/qe-deploy-ocs-cluster/ocs-ci/venv/lib/python3.6/site-packages/pytest_html/plugin.py", line 130, in __init__
INTERNALERROR>     report=report, cells=cells)
INTERNALERROR>   File "/home/jenkins/workspace/qe-deploy-ocs-cluster/ocs-ci/venv/lib/python3.6/site-packages/pluggy/hooks.py", line 289, in __call__
INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "/home/jenkins/workspace/qe-deploy-ocs-cluster/ocs-ci/venv/lib/python3.6/site-packages/pluggy/manager.py", line 87, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/home/jenkins/workspace/qe-deploy-ocs-cluster/ocs-ci/venv/lib/python3.6/site-packages/pluggy/manager.py", line 81, in <lambda>
INTERNALERROR>     firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR>   File "/home/jenkins/workspace/qe-deploy-ocs-cluster/ocs-ci/venv/lib/python3.6/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/home/jenkins/workspace/qe-deploy-ocs-cluster/ocs-ci/venv/lib/python3.6/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/home/jenkins/workspace/qe-deploy-ocs-cluster/ocs-ci/venv/lib/python3.6/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/home/jenkins/workspace/qe-deploy-ocs-cluster/ocs-ci/ocs_ci/framework/pytest_customization/reports.py", line 21, in pytest_html_results_table_row
INTERNALERROR>     cells.insert(2, html.td(report.description))
INTERNALERROR> AttributeError: 'CollectReport' object has no attribute 'description'
```

This traceback shouldn't hide the real issue.


Changed files:
ocs_ci/framework/pytest_customization/reports.py

diff --git a/ocs_ci/framework/pytest_customization/reports.py b/ocs_ci/framework/pytest_customization/reports.py
index d2fc442b..32237958 100644
--- a/ocs_ci/framework/pytest_customization/reports.py
+++ b/ocs_ci/framework/pytest_customization/reports.py
@@ -18,7 +18,10 @@ def pytest_html_results_table_row(report, cells):
     """
     Add content to the column Description
     """
-    cells.insert(2, html.td(report.description))
+    try:
+        cells.insert(2, html.td(report.description))
+    except AttributeError:
+        cells.insert(2, html.td('--- no description ---'))
 
 
 @pytest.mark.hookwrapper