[saem-devel] [PATCH] [test] Fix EACWSTC.test_xml_post with lxml >= 3.7

Philippe Pepiot philippe.pepiot at logilab.fr
Wed Feb 8 11:44:35 CET 2017


# HG changeset patch
# User Philippe Pepiot <philippe.pepiot at logilab.fr>
# Date 1486550549 -3600
#      Wed Feb 08 11:42:29 2017 +0100
# Node ID 4d11ce15c015713b36d3b83886b7a32390175cf1
# Parent  e3bf7f922862dea370e930c283a04dcb8e0e6d1e
[test] Fix EACWSTC.test_xml_post with lxml >= 3.7

Exception message of etree.XMLSyntaxError has changed

diff --git a/test/test_pviews.py b/test/test_pviews.py
--- a/test/test_pviews.py
+++ b/test/test_pviews.py
@@ -16,6 +16,8 @@
 # with this program. If not, see <http://www.gnu.org/licenses/>.
 """cubicweb-saem-ref test for pyramid views."""
 
+import lxml.etree
+
 from cubicweb.pyramid.test import PyramidCWTest
 
 import testutils
@@ -59,9 +61,13 @@ class EACWSTC(PyramidCWTest):
                                content_type='application/xml',
                                headers={'Accept': 'application/json'},
                                status=400)
+
+        expected_details = "Start tag expected, '<' not found, line 1, column 1"
+        if lxml.etree.LXML_VERSION[:2] >= (3, 7):
+            expected_details += " (line 1)"
         self.assertEqual(res.json,
                          {'error': u'Invalid XML file',
-                          'details': "Start tag expected, '<' not found, line 1, column 1"})
+                          'details': expected_details})
 
         res = self.webapp.post('/authorityrecord',
                                params='<xml xmlns="bla"/>',



More information about the saem-devel mailing list