|
12 | 12 | from _pytest.python import Class, Function, Instance, Module |
13 | 13 | from _pytest.doctest import DoctestItem |
14 | 14 | from _pytest.nodes import File, Item |
| 15 | +from _pytest.unittest import TestCaseFunction, UnitTestCase |
15 | 16 | from reportportal_client import ReportPortalServiceAsync |
16 | 17 |
|
17 | 18 | log = logging.getLogger(__name__) |
@@ -157,13 +158,18 @@ def collect_tests(self, session): |
157 | 158 | item_parts = self._get_item_parts(item) |
158 | 159 | rp_name = self._add_item_hier_parts_other(item_parts, item, Module, hier_module, parts, rp_name) |
159 | 160 | rp_name = self._add_item_hier_parts_other(item_parts, item, Class, hier_class, parts, rp_name) |
| 161 | + # Hierarchy for unittest TestCase (class) |
| 162 | + rp_name = self._add_item_hier_parts_other(item_parts, item, UnitTestCase, hier_class, parts, rp_name) |
| 163 | + |
160 | 164 |
|
161 | 165 | # Hierarchy for parametrized tests |
162 | 166 | if hier_param: |
163 | 167 | rp_name = self._add_item_hier_parts_parametrize(item, parts, tests_parts, rp_name) |
164 | 168 |
|
165 | 169 | # Hierarchy for test itself |
166 | 170 | self._add_item_hier_parts_other(item_parts, item, Function, True, parts, rp_name) |
| 171 | + # Hierarchy for unittest TestCaseFunction (test) |
| 172 | + self._add_item_hier_parts_other(item_parts, item, TestCaseFunction, True, parts, rp_name) |
167 | 173 |
|
168 | 174 | # Result initialization |
169 | 175 | for part in parts: |
@@ -363,7 +369,7 @@ def _add_item_hier_parts_other(item_parts, item, item_type, hier_flag, report_pa |
363 | 369 | if item_type is Module: |
364 | 370 | module_path = str(item.fspath.new(dirname=rp_name, basename=part.fspath.basename, drive="")) |
365 | 371 | rp_name = module_path if rp_name else module_path[1:] |
366 | | - elif item_type in (Class, Function): |
| 372 | + elif item_type in (Class, Function, UnitTestCase, TestCaseFunction): |
367 | 373 | rp_name += ("::" if rp_name else "") + part.name |
368 | 374 |
|
369 | 375 | if hier_flag: |
|
0 commit comments