(pytester: Pytester, junit_logging: str)
| 1025 | |
| 1026 | @pytest.mark.parametrize("junit_logging", ["no", "system-out"]) |
| 1027 | def test_nullbyte_replace(pytester: Pytester, junit_logging: str) -> None: |
| 1028 | # Check if the null byte gets replaced |
| 1029 | pytester.makepyfile( |
| 1030 | """ |
| 1031 | import sys |
| 1032 | def test_print_nullbyte(): |
| 1033 | sys.stdout.write('Here the null -->' + chr(0) + '<--') |
| 1034 | sys.stdout.write('In repr form -->' + repr(chr(0)) + '<--') |
| 1035 | assert False |
| 1036 | """ |
| 1037 | ) |
| 1038 | xmlf = pytester.path.joinpath("junit.xml") |
| 1039 | pytester.runpytest("--junitxml=%s" % xmlf, "-o", "junit_logging=%s" % junit_logging) |
| 1040 | text = xmlf.read_text() |
| 1041 | if junit_logging == "system-out": |
| 1042 | assert "#x0" in text |
| 1043 | if junit_logging == "no": |
| 1044 | assert "#x0" not in text |
| 1045 | |
| 1046 | |
| 1047 | def test_invalid_xml_escape() -> None: |
nothing calls this directly
no test coverage detected