|
1 | 1 | from __future__ import annotations |
2 | 2 | from typing import List, TYPE_CHECKING |
| 3 | +from xml.sax.saxutils import escape |
3 | 4 | import os |
4 | 5 |
|
5 | 6 | from testipy import get_exec_logger |
@@ -63,7 +64,7 @@ def end_suite(self, sd: SuiteDetails): |
63 | 64 | def start_test(self, current_test: TestDetails): |
64 | 65 | pass |
65 | 66 |
|
66 | | - def test_info(self, current_test: TestDetails, info, level, attachment=None): |
| 67 | + def test_info(self, current_test: TestDetails, info, level, attachment=None, true_html: bool = False): |
67 | 68 | pass |
68 | 69 |
|
69 | 70 | def test_step( |
@@ -204,17 +205,17 @@ def _generate_failure_detail(self, xml_file, fail_counters: StateCounter, test_c |
204 | 205 | category = file = method = code = "-" |
205 | 206 | line = 0 |
206 | 207 |
|
207 | | - xml_file.write(f"{failure_type}: {reason_of_state}\n") |
208 | | - xml_file.write(f"Category: {category}\n") |
209 | | - xml_file.write(f"File: {file}\n") |
210 | | - xml_file.write(f"Line: {line}\n") |
211 | | - xml_file.write(f"Method: {method}\n") |
212 | | - xml_file.write(f"Code: {code}\n") |
| 208 | + xml_file.write(f"Category: {escape(category)}\n") |
| 209 | + xml_file.write(f" Message: {escape(reason_of_state)}\n") |
| 210 | + xml_file.write(f" File: {escape(file)}\n") |
| 211 | + xml_file.write(f" Line: {line}\n") |
| 212 | + xml_file.write(f" Method: {escape(method)}\n") |
| 213 | + xml_file.write(f" Code: {escape(code)}\n") |
213 | 214 |
|
214 | 215 | xml_file.write(" </failure>\n") |
215 | 216 |
|
216 | 217 |
|
217 | 218 | def string_fixer(text): |
218 | 219 | if not isinstance(text, str): |
219 | 220 | text = str(text) |
220 | | - return text.replace('"', "'").replace("\n", " | ") |
| 221 | + return escape(text.replace('"', "'").replace("\n", " | ")) |
0 commit comments