|
14 | 14 | from allure_commons.model2 import Label, Link |
15 | 15 | from allure_commons.model2 import Status |
16 | 16 | from allure_commons.types import LabelType |
| 17 | +from allure_pytest.utils import allure_description, allure_description_html |
17 | 18 | from allure_pytest.utils import allure_labels, allure_links, pytest_markers |
18 | 19 | from allure_pytest.utils import allure_full_name, allure_package, allure_name |
19 | 20 | from allure_pytest.utils import get_status, get_status_details |
@@ -65,11 +66,10 @@ def pytest_runtest_protocol(self, item, nextitem): |
65 | 66 | self.allure_logger.update_group(group_uuid, children=uuid) |
66 | 67 |
|
67 | 68 | test_case = TestResult(name=allure_name(item), uuid=uuid) |
68 | | - self.allure_logger.schedule_test(uuid, test_case) |
69 | | - |
70 | | - if hasattr(item, 'function'): |
71 | | - test_case.description = item.function.__doc__ |
| 69 | + test_case.description = allure_description(item) |
| 70 | + test_case.descriptionHtml = allure_description_html(item) |
72 | 71 |
|
| 72 | + self.allure_logger.schedule_test(uuid, test_case) |
73 | 73 | yield |
74 | 74 |
|
75 | 75 | for name, value in item.callspec.params.items() if hasattr(item, 'callspec') else (): |
@@ -192,6 +192,24 @@ def attach_data(self, body, name, attachment_type, extension): |
192 | 192 | def attach_file(self, source, name, attachment_type, extension): |
193 | 193 | self.allure_logger.attach_file(uuid4(), source, name=name, attachment_type=attachment_type, extension=extension) |
194 | 194 |
|
| 195 | + @allure_commons.hookimpl |
| 196 | + def add_title(self, test_title): |
| 197 | + test_result = self.allure_logger.get_test(None) |
| 198 | + if test_result: |
| 199 | + test_result.name = test_title |
| 200 | + |
| 201 | + @allure_commons.hookimpl |
| 202 | + def add_description(self, test_description): |
| 203 | + test_result = self.allure_logger.get_test(None) |
| 204 | + if test_result: |
| 205 | + test_result.description = test_description |
| 206 | + |
| 207 | + @allure_commons.hookimpl |
| 208 | + def add_description_html(self, test_description_html): |
| 209 | + test_result = self.allure_logger.get_test(None) |
| 210 | + if test_result: |
| 211 | + test_result.descriptionHtml = test_description_html |
| 212 | + |
195 | 213 | @allure_commons.hookimpl |
196 | 214 | def add_link(self, url, link_type, name): |
197 | 215 | test_result = self.allure_logger.get_test(None) |
|
0 commit comments