MCPcopy
hub / github.com/pytest-dev/pytest / test_nullbyte_replace

Function test_nullbyte_replace

testing/test_junitxml.py:1093–1110  ·  view source on GitHub ↗
(pytester: Pytester, junit_logging: str)

Source from the content-addressed store, hash-verified

1091
1092@pytest.mark.parametrize("junit_logging", ["no", "system-out"])
1093def 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
1113def test_invalid_xml_escape() -> None:

Callers

nothing calls this directly

Calls 3

read_textMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…