Starou / SimpleIDML

Manipulate Adobe® InDesign® IDML files
Other
209 stars 35 forks source link

Upgrade lxml version / Fix Python > 2.7.10 #39

Closed Starou closed 6 years ago

Starou commented 6 years ago

The recent work on porting the codebase to Python 3 shows that having the last version of lxml is not the reason for having the test suite to fails. The reason is the minor version of Python 2.7.

Python 2.7.10 : OK Python 2.7.12 : 1 error :

======================================================================
FAIL: test_add_pages_from_idml_to_template (regressiontests.idml.IdmlTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/vagrant/tests/regressiontests/idml.py", line 3637, in test_add_pages_from_idml_to_template
    self.assertEqual(len(f.pages), 4)
AssertionError: 2 != 4

----------------------------------------------------------------------

Python 2.7.14: 2 errors.

So it is safe to relax the lxml version constraints.

Starou commented 6 years ago

Fails on Travis (Ubuntu Trusty 14.04.05 LTS, Python 2.7.13) when the version of lxml is not set to 3.6:

======================================================================
ERROR: test_attributes (regressiontests.components.XMLElementTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/Starou/SimpleIDML/tests/regressiontests/components.py", line 428, in test_attributes
    self.assertEqual(module_elt.get_attribute("foo"), None)
  File "../src/simple_idml/components.py", line 904, in get_attribute
    attr_node = self._get_attribute_node(name)
  File "../src/simple_idml/components.py", line 909, in _get_attribute_node
    attr_node = self.xpath("./XMLAttribute[@Name='%s']" % name)
  File "src/lxml/etree.pyx", line 1586, in lxml.etree._Element.xpath (src/lxml/etree.c:61218)
TypeError: Argument 'element' has incorrect type (expected lxml.etree._Element, got XMLElement)
Starou commented 6 years ago
Starou commented 6 years ago

Fixed in Python3 support branch