(pytester: Pytester, junit_logging: str)
| 1091 | |
| 1092 | @pytest.mark.parametrize("junit_logging", ["no", "system-out"]) |
| 1093 | def test_nullbyte_replace(pytester: Pytester, junit_logging: str) -> None: |
| 1094 | # Check if the null byte gets replaced |
| 1095 | pytester.makepyfile( |
| 1096 | """ |
| 1097 | import sys |
| 1098 | def test_print_nullbyte(): |
| 1099 | sys.stdout.write('Here the null -->' + chr(0) + '<--') |
| 1100 | sys.stdout.write('In repr form -->' + repr(chr(0)) + '<--') |
| 1101 | assert False |
| 1102 | """ |
| 1103 | ) |
| 1104 | xmlf = pytester.path.joinpath("junit.xml") |
| 1105 | pytester.runpytest(f"--junitxml={xmlf}", "-o", f"junit_logging={junit_logging}") |
| 1106 | text = xmlf.read_text(encoding="utf-8") |
| 1107 | if junit_logging == "system-out": |
| 1108 | assert "#x0" in text |
| 1109 | if junit_logging == "no": |
| 1110 | assert "#x0" not in text |
| 1111 | |
| 1112 | |
| 1113 | def test_invalid_xml_escape() -> None: |
nothing calls this directly
no test coverage detected
searching dependent graphs…