From 0bffd604b44213947090f06580fefa48fa67096d Mon Sep 17 00:00:00 2001 From: Sam Sneddon Date: Fri, 22 May 2020 20:52:20 +0100 Subject: [PATCH 1/2] Fix #488: append document-child comments in document order in lxml --- .pytest.expect | 2 -- html5lib/treebuilders/etree_lxml.py | 6 +++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.pytest.expect b/.pytest.expect index 4961b00f..22cf51bb 100644 --- a/.pytest.expect +++ b/.pytest.expect @@ -1297,8 +1297,6 @@ u'html5lib/tests/testdata/tree-construction/tests8.dat::5::cElementTree::parser: u'html5lib/tests/testdata/tree-construction/tests8.dat::5::cElementTree::parser::void-namespace': FAIL u'html5lib/tests/testdata/tree-construction/tests8.dat::5::lxml::parser::namespaced': FAIL u'html5lib/tests/testdata/tree-construction/tests8.dat::5::lxml::parser::void-namespace': FAIL -u'html5lib/tests/testdata/tree-construction/webkit01.dat::22::lxml::parser::namespaced': FAIL -u'html5lib/tests/testdata/tree-construction/webkit01.dat::22::lxml::parser::void-namespace': FAIL u'html5lib/tests/testdata/tree-construction/webkit02.dat::14::DOM::parser::namespaced': FAIL u'html5lib/tests/testdata/tree-construction/webkit02.dat::14::DOM::parser::void-namespace': FAIL u'html5lib/tests/testdata/tree-construction/webkit02.dat::14::ElementTree::parser::namespaced': FAIL diff --git a/html5lib/treebuilders/etree_lxml.py b/html5lib/treebuilders/etree_lxml.py index ca12a99c..227a0b24 100644 --- a/html5lib/treebuilders/etree_lxml.py +++ b/html5lib/treebuilders/etree_lxml.py @@ -44,7 +44,11 @@ def __init__(self): self._childNodes = [] def appendChild(self, element): - self._elementTree.getroot().addnext(element._element) + last = self._elementTree.getroot() + for last in self._elementTree.getroot().itersiblings(): + pass + + last.addnext(element._element) def _getChildNodes(self): return self._childNodes From beecdf46762ceb7155824c2a37de04dc19593006 Mon Sep 17 00:00:00 2001 From: Sam Sneddon Date: Tue, 9 Jun 2020 01:58:19 +0100 Subject: [PATCH 2/2] Reduce number of Travis CI jobs --- .travis.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8082e05f..6561e2a3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,10 +14,7 @@ cache: pip env: global: - PYTEST_COMMAND="coverage run -m pytest" - matrix: - - TOXENV=optional - - TOXENV=base - - TOXENV=six19-optional + - TOXENV=base,optional,six19-optional install: - pip install tox codecov