(report_path)
| 2231 | |
| 2232 | |
| 2233 | def _fix_html_report(report_path): |
| 2234 | # (Only if there's a pytest-html report present) |
| 2235 | with suppress(Exception): |
| 2236 | abs_path = os.path.abspath(".") |
| 2237 | html_report_path = os.path.join(abs_path, report_path) |
| 2238 | if not os.path.exists(html_report_path): |
| 2239 | return |
| 2240 | the_html_r = None |
| 2241 | with open(html_report_path, mode="r", encoding="utf-8") as f: |
| 2242 | the_html_r = f.read() |
| 2243 | if "page to ge the" not in the_html_r: |
| 2244 | return # The typo was already fixed |
| 2245 | # Collapsible rows are trickier to select for copy/paste |
| 2246 | the_html_r = the_html_r.replace( |
| 2247 | "findAll('.collapsible", "//findAll('.collapsible" |
| 2248 | ) |
| 2249 | # Fix typo in pytest-html 4.0.2 |
| 2250 | # (Later versions have a worse bug that prevents live updates) |
| 2251 | the_html_r = the_html_r.replace("page to ge the", "page to get the") |
| 2252 | with open(html_report_path, mode="w", encoding="utf-8") as f: |
| 2253 | f.write(the_html_r) # Update the HTML report |
| 2254 | |
| 2255 | |
| 2256 | def pytest_runtest_teardown(item): |
no test coverage detected
searching dependent graphs…