fix junitxml generation when test output contains control characters,
addressing issue267
This commit is contained in:
commit
67279418ff
|
@ -15,6 +15,9 @@ Changes between 2.3.5 and 2.4.DEV
|
||||||
which fixes py.io.dupfile to work with files with no
|
which fixes py.io.dupfile to work with files with no
|
||||||
mode. Thanks Jason R. Coombs.
|
mode. Thanks Jason R. Coombs.
|
||||||
|
|
||||||
|
- fix junitxml generation when test output contains control characters,
|
||||||
|
addressing issue267
|
||||||
|
|
||||||
- honor --tb style for setup/teardown errors as well. Thanks Maho.
|
- honor --tb style for setup/teardown errors as well. Thanks Maho.
|
||||||
|
|
||||||
Changes between 2.3.4 and 2.3.5
|
Changes between 2.3.4 and 2.3.5
|
||||||
|
|
|
@ -36,7 +36,8 @@ class Junit(py.xml.Namespace):
|
||||||
# | [#x10000-#x10FFFF]
|
# | [#x10000-#x10FFFF]
|
||||||
_legal_chars = (0x09, 0x0A, 0x0d)
|
_legal_chars = (0x09, 0x0A, 0x0d)
|
||||||
_legal_ranges = (
|
_legal_ranges = (
|
||||||
(0x20, 0xD7FF),
|
(0x20, 0x7E),
|
||||||
|
(0x80, 0xD7FF),
|
||||||
(0xE000, 0xFFFD),
|
(0xE000, 0xFFFD),
|
||||||
(0x10000, 0x10FFFF),
|
(0x10000, 0x10FFFF),
|
||||||
)
|
)
|
||||||
|
@ -103,7 +104,7 @@ class LogXML(object):
|
||||||
classnames.insert(0, self.prefix)
|
classnames.insert(0, self.prefix)
|
||||||
self.tests.append(Junit.testcase(
|
self.tests.append(Junit.testcase(
|
||||||
classname=".".join(classnames),
|
classname=".".join(classnames),
|
||||||
name=names[-1],
|
name=bin_xml_escape(names[-1]),
|
||||||
time=getattr(report, 'duration', 0)
|
time=getattr(report, 'duration', 0)
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
|
@ -450,3 +450,16 @@ def test_logxml_changingdir(testdir):
|
||||||
assert result.ret == 0
|
assert result.ret == 0
|
||||||
assert testdir.tmpdir.join("a/x.xml").check()
|
assert testdir.tmpdir.join("a/x.xml").check()
|
||||||
|
|
||||||
|
def test_escaped_parametrized_names_xml(testdir):
|
||||||
|
testdir.makepyfile("""
|
||||||
|
import pytest
|
||||||
|
@pytest.mark.parametrize('char', ["\\x00"])
|
||||||
|
def test_func(char):
|
||||||
|
assert char
|
||||||
|
""")
|
||||||
|
result, dom = runandparse(testdir)
|
||||||
|
assert result.ret == 0
|
||||||
|
node = dom.getElementsByTagName("testcase")[0]
|
||||||
|
assert_attr(node,
|
||||||
|
name="test_func[#x00]")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue