Tests failing on py3.9 due to no attribute getiterator

Bug #1880668 reported by Michał Górny
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxml
Fix Released
Low
Unassigned

Bug Description

I'm getting the following test failures when testing lxml on py3.9. For the record, cython had a few test failures too, so it might be cython's fault.

======================================================================
ERROR: test_elementtree_getiterator (lxml.tests.test_elementtree.ElementTreeTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.9/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/lib/python3.9/unittest/case.py", line 593, in run
    self._callTestMethod(testMethod)
  File "/usr/lib/python3.9/unittest/case.py", line 550, in _callTestMethod
    method()
  File "/tmp/portage/dev-python/lxml-4.5.1/work/lxml-lxml-4.5.1-python3_9/build/lib/lxml/tests/test_elementtree.py", line 2727, in test_elementtree_getiterator
    list(t.getiterator()))
AttributeError: 'ElementTree' object has no attribute 'getiterator'

======================================================================
ERROR: test_elementtree_getiterator_filter (lxml.tests.test_elementtree.ElementTreeTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.9/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/lib/python3.9/unittest/case.py", line 593, in run
    self._callTestMethod(testMethod)
  File "/usr/lib/python3.9/unittest/case.py", line 550, in _callTestMethod
    method()
  File "/tmp/portage/dev-python/lxml-4.5.1/work/lxml-lxml-4.5.1-python3_9/build/lib/lxml/tests/test_elementtree.py", line 2742, in test_elementtree_getiterator_filter
    list(t.getiterator('a')))
AttributeError: 'ElementTree' object has no attribute 'getiterator'

======================================================================
ERROR: test_getchildren (lxml.tests.test_elementtree.ElementTreeTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.9/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/lib/python3.9/unittest/case.py", line 593, in run
    self._callTestMethod(testMethod)
  File "/usr/lib/python3.9/unittest/case.py", line 550, in _callTestMethod
    method()
  File "/tmp/portage/dev-python/lxml-4.5.1/work/lxml-lxml-4.5.1-python3_9/build/lib/lxml/tests/test_elementtree.py", line 1950, in test_getchildren
    a.getchildren())
AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getchildren'

======================================================================
ERROR: test_getiterator (lxml.tests.test_elementtree.ElementTreeTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.9/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/lib/python3.9/unittest/case.py", line 593, in run
    self._callTestMethod(testMethod)
  File "/usr/lib/python3.9/unittest/case.py", line 550, in _callTestMethod
    method()
  File "/tmp/portage/dev-python/lxml-4.5.1/work/lxml-lxml-4.5.1-python3_9/build/lib/lxml/tests/test_elementtree.py", line 2025, in test_getiterator
    list(a.getiterator()))
AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getiterator'

======================================================================
ERROR: test_getiterator_empty (lxml.tests.test_elementtree.ElementTreeTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.9/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/lib/python3.9/unittest/case.py", line 593, in run
    self._callTestMethod(testMethod)
  File "/usr/lib/python3.9/unittest/case.py", line 550, in _callTestMethod
    method()
  File "/tmp/portage/dev-python/lxml-4.5.1/work/lxml-lxml-4.5.1-python3_9/build/lib/lxml/tests/test_elementtree.py", line 2042, in test_getiterator_empty
    list(a.getiterator('none')))
AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getiterator'

======================================================================
ERROR: test_getiterator_filter (lxml.tests.test_elementtree.ElementTreeTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.9/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/lib/python3.9/unittest/case.py", line 593, in run
    self._callTestMethod(testMethod)
  File "/usr/lib/python3.9/unittest/case.py", line 550, in _callTestMethod
    method()
  File "/tmp/portage/dev-python/lxml-4.5.1/work/lxml-lxml-4.5.1-python3_9/build/lib/lxml/tests/test_elementtree.py", line 2062, in test_getiterator_filter
    list(a.getiterator('a')))
AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getiterator'

======================================================================
ERROR: test_getiterator_filter_all (lxml.tests.test_elementtree.ElementTreeTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.9/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/lib/python3.9/unittest/case.py", line 593, in run
    self._callTestMethod(testMethod)
  File "/usr/lib/python3.9/unittest/case.py", line 550, in _callTestMethod
    method()
  File "/tmp/portage/dev-python/lxml-4.5.1/work/lxml-lxml-4.5.1-python3_9/build/lib/lxml/tests/test_elementtree.py", line 2083, in test_getiterator_filter_all
    list(a.getiterator('*')))
AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getiterator'

======================================================================
ERROR: test_getiterator_filter_comment (lxml.tests.test_elementtree.ElementTreeTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.9/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/lib/python3.9/unittest/case.py", line 593, in run
    self._callTestMethod(testMethod)
  File "/usr/lib/python3.9/unittest/case.py", line 550, in _callTestMethod
    method()
  File "/tmp/portage/dev-python/lxml-4.5.1/work/lxml-lxml-4.5.1-python3_9/build/lib/lxml/tests/test_elementtree.py", line 2097, in test_getiterator_filter_comment
    list(a.getiterator(Comment)))
AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getiterator'

======================================================================
ERROR: test_getiterator_filter_pi (lxml.tests.test_elementtree.ElementTreeTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.9/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/lib/python3.9/unittest/case.py", line 593, in run
    self._callTestMethod(testMethod)
  File "/usr/lib/python3.9/unittest/case.py", line 550, in _callTestMethod
    method()
  File "/tmp/portage/dev-python/lxml-4.5.1/work/lxml-lxml-4.5.1-python3_9/build/lib/lxml/tests/test_elementtree.py", line 2122, in test_getiterator_filter_pi
    list(a.getiterator(PI)))
AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getiterator'

======================================================================
ERROR: test_getiterator_filter_with_text (lxml.tests.test_elementtree.ElementTreeTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.9/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/lib/python3.9/unittest/case.py", line 593, in run
    self._callTestMethod(testMethod)
  File "/usr/lib/python3.9/unittest/case.py", line 550, in _callTestMethod
    method()
  File "/tmp/portage/dev-python/lxml-4.5.1/work/lxml-lxml-4.5.1-python3_9/build/lib/lxml/tests/test_elementtree.py", line 2182, in test_getiterator_filter_with_text
    list(a.getiterator('a')))
AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getiterator'

======================================================================
ERROR: test_getiterator_with_text (lxml.tests.test_elementtree.ElementTreeTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.9/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/lib/python3.9/unittest/case.py", line 593, in run
    self._callTestMethod(testMethod)
  File "/usr/lib/python3.9/unittest/case.py", line 550, in _callTestMethod
    method()
  File "/tmp/portage/dev-python/lxml-4.5.1/work/lxml-lxml-4.5.1-python3_9/build/lib/lxml/tests/test_elementtree.py", line 2156, in test_getiterator_with_text
    list(a.getiterator()))
AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getiterator'

======================================================================
ERROR: test_interface (lxml.tests.test_elementtree.ElementTreeTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.9/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/lib/python3.9/unittest/case.py", line 593, in run
    self._callTestMethod(testMethod)
  File "/usr/lib/python3.9/unittest/case.py", line 550, in _callTestMethod
    method()
  File "/tmp/portage/dev-python/lxml-4.5.1/work/lxml-lxml-4.5.1-python3_9/build/lib/lxml/tests/test_elementtree.py", line 48, in testfunc
    return method(self, *args)
  File "/tmp/portage/dev-python/lxml-4.5.1/work/lxml-lxml-4.5.1-python3_9/build/lib/lxml/tests/test_elementtree.py", line 133, in test_interface
    check_method(element.getchildren)
AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getchildren'

======================================================================
ERROR: test_iterparse_getiterator (lxml.tests.test_elementtree.ElementTreeTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.9/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/lib/python3.9/unittest/case.py", line 593, in run
    self._callTestMethod(testMethod)
  File "/usr/lib/python3.9/unittest/case.py", line 550, in _callTestMethod
    method()
  File "/tmp/portage/dev-python/lxml-4.5.1/work/lxml-lxml-4.5.1-python3_9/build/lib/lxml/tests/test_elementtree.py", line 3190, in test_iterparse_getiterator
    counts.append(len(list(elem.getiterator())))
AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getiterator'

----------------------------------------------------------------------
Ran 1934 tests in 15.502s

FAILED (errors=13)
Comparing with ElementTree 1.3.0

TESTED VERSION: 4.5.1
    Python: sys.version_info(major=3, minor=9, micro=0, releaselevel='beta', serial=1)
    lxml.etree: (4, 5, 1, 0)
    libxml used: (2, 9, 9)
    libxml compiled: (2, 9, 9)
    libxslt used: (1, 1, 33)
    libxslt compiled: (1, 1, 33)
    FS encoding: utf-8
    Default encoding: utf-8
    Max Unicode: 1114111

Revision history for this message
scoder (scoder) wrote :

Thanks for the report. These are just compatibility tests. The "xml.etree.ElementTree" package in Python has removed some deprecated features.

I moved them out of the way here:
https://github.com/lxml/lxml/commit/e5c5cd22d918cd3b196e109a7829dad02d9ef42e

Changed in lxml:
importance: Undecided → Low
status: New → Fix Committed
milestone: none → 4.5.2
Revision history for this message
Michał Górny (mgorny) wrote :

Thank you for the prompt fix!

scoder (scoder)
Changed in lxml:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.