def test_bin_escaped_skipreason(pytester: Pytester, run_and_parse: RunAndParse) -> None:
    """Escape special characters from mark.skip reason (#11842)."""
    pytester.makepyfile(
        """
        import pytest
        @pytest.mark.skip("\33[31;1mred\33[0m")
        def test_skip():
            pass
    """
    )
    _, dom = run_and_parse()
    node = dom.get_first_by_tag("testcase")
    snode = node.get_first_by_tag("skipped")
    assert "#x1B[31;1mred#x1B[0m" in snode.text
    snode.assert_attr(message="#x1B[31;1mred#x1B[0m")
Escape special characters from mark.skip reason (#11842).
testing/test_junitxml.py