1 new commit in pytest:
https://bitbucket.org/hpk42/pytest/commits/e629b41d0f58/
Changeset: e629b41d0f58
User: RonnyPfannschmidt
Date: 2013-12-13 10:28:23
Summary: fix issue404 by more strict junitxml escape
Affected #: 3 files
diff -r 70dae16174e4797de84b2bbbcb099c026f59d459 -r
e629b41d0f58f215347d34e18b48f63dba5310f5 CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,8 @@
+Unreleased
+-----------------------------------
+
+- fix issue404 by always using the binary xml escape in the junitxml plugin
+
2.5.0
-----------------------------------
diff -r 70dae16174e4797de84b2bbbcb099c026f59d459 -r
e629b41d0f58f215347d34e18b48f63dba5310f5 _pytest/junitxml.py
--- a/_pytest/junitxml.py
+++ b/_pytest/junitxml.py
@@ -130,36 +130,36 @@
self.skipped += 1
else:
fail = Junit.failure(message="test failure")
- fail.append(unicode(report.longrepr))
+ fail.append(bin_xml_escape(report.longrepr))
self.append(fail)
self.failed += 1
self._write_captured_output(report)
def append_collect_failure(self, report):
#msg = str(report.longrepr.reprtraceback.extraline)
- self.append(Junit.failure(unicode(report.longrepr),
+ self.append(Junit.failure(bin_xml_escape(report.longrepr),
message="collection failure"))
self.errors += 1
def append_collect_skipped(self, report):
#msg = str(report.longrepr.reprtraceback.extraline)
- self.append(Junit.skipped(unicode(report.longrepr),
+ self.append(Junit.skipped(bin_xml_escape(report.longrepr),
message="collection skipped"))
self.skipped += 1
def append_error(self, report):
- self.append(Junit.error(unicode(report.longrepr),
+ self.append(Junit.error(bin_xml_escape(report.longrepr),
message="test setup failure"))
self.errors += 1
def append_skipped(self, report):
if hasattr(report, "wasxfail"):
- self.append(Junit.skipped(unicode(report.wasxfail),
+ self.append(Junit.skipped(bin_xml_escape(report.wasxfail),
message="expected test failure"))
else:
filename, lineno, skipreason = report.longrepr
if skipreason.startswith("Skipped: "):
- skipreason = skipreason[9:]
+ skipreason = bin_xml_escape(skipreason[9:])
self.append(
Junit.skipped("%s:%s: %s" % report.longrepr,
type="pytest.skip",
@@ -193,7 +193,7 @@
def pytest_internalerror(self, excrepr):
self.errors += 1
- data = py.xml.escape(excrepr)
+ data = bin_xml_escape(excrepr)
self.tests.append(
Junit.testcase(
Junit.error(data, message="internal error"),
diff -r 70dae16174e4797de84b2bbbcb099c026f59d459 -r
e629b41d0f58f215347d34e18b48f63dba5310f5 testing/test_junitxml.py
--- a/testing/test_junitxml.py
+++ b/testing/test_junitxml.py
@@ -284,6 +284,19 @@
if not sys.platform.startswith("java"):
assert "hx" in fnode.toxml()
+ def test_assertion_binchars(self, testdir):
+ """this test did fail when the escaping wasnt strict"""
+ testdir.makepyfile("""
+
+ M1 = '\x01\x02\x03\x04'
+ M2 = '\x01\x02\x03\x05'
+
+ def test_str_compare():
+ assert M1 == M2
+ """)
+ result, dom = runandparse(testdir)
+ print dom.toxml()
+
def test_pass_captures_stdout(self, testdir):
testdir.makepyfile("""
def test_pass():
@@ -392,7 +405,6 @@
text = xmlf.read()
assert '#x0' in text
-
def test_invalid_xml_escape():
# Test some more invalid xml chars, the full range should be
# tested really but let's just thest the edges of the ranges
Repository URL: https://bitbucket.org/hpk42/pytest/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
pytest-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pytest-commit