def compare_html(
    expected: str,
    actual: str,
    extra_scrubs: list[tuple[str, str]] | None = None,
) -> None:
    """Specialized compare function for our HTML files."""
    __tracebackhide__ = True    # pytest, please don't show me this function.
    scrubs = [
        (r'/coverage\.readthedocs\.io/?[-.\w/]*', '/coverage.readthedocs.io/VER'),
        (r'coverage\.py v[\d.abcdev]+', 'coverage.py vVER'),
        (r'created at \d\d\d\d-\d\d-\d\d \d\d:\d\d [-+]\d\d\d\d', 'created at DATE'),
        (r'created at \d\d\d\d-\d\d-\d\d \d\d:\d\d', 'created at DATE'),
        # Static files have cache busting.
        (r'_cb_\w{8}\.', '_CB.'),
        # Occasionally an absolute path is in the HTML report.
        (filepath_to_regex(TESTS_DIR), 'TESTS_DIR'),
        (filepath_to_regex(flat_rootname(str(TESTS_DIR))), '_TESTS_DIR'),
        # The temp dir the tests make.
        (filepath_to_regex(os.getcwd()), 'TEST_TMPDIR'),
        (filepath_to_regex(flat_rootname(str(os.getcwd()))), '_TEST_TMPDIR'),
        (filepath_to_regex(abs_file(os.getcwd())), 'TEST_TMPDIR'),
        (filepath_to_regex(flat_rootname(str(abs_file(os.getcwd())))), '_TEST_TMPDIR'),
        (r'/private/var/[\w/]+/pytest-of-\w+/pytest-\d+/(popen-gw\d+/)?t\d+', 'TEST_TMPDIR'),
        # If the gold files were created on Windows, we need to scrub Windows paths also:
        (r'[A-Z]:\\Users\\[\w\\]+\\pytest-of-\w+\\pytest-\d+\\(popen-gw\d+\\)?t\d+', 'TEST_TMPDIR'),
    ]
    if extra_scrubs:
        scrubs += extra_scrubs
    compare(expected, actual, file_pattern="*.html", scrubs=scrubs)
Specialized compare function for our HTML files.
tests/test_html.py