◐ Shell
clean mode source ↗

XML-related test failures

I want to push more on getting RustPython's XML capabilities on par with CPython's, so we can replace extratests/json-tests.py with a more robust solution involving CPython's own test harness (the --junit-xml flag on python -m test). A lot of this may involve making the xml crate "behave" more like the libexpat parser. The goal is not to get all of these boxes checked, but to get enough of them checked such that, e.g., rustpython -m test --junit-xml test.xml tests.xmltests will output valid XML. Here's the current state of play (as of 14 June 2026):

Lib/test/test_minidom.py

  • class MinidomTest:
    • testGetElementsByTagNameNS()
    • testWriteXML()
    • testAltNewline()
    • testProcessingInstruction()
    • testProcessingInstructionRepr()
    • testRemoveNamedItem()
    • testRemoveNamedItemNS()
    • testCloneElementShallow()
    • testCloneAttributeShallow()
    • testCloneAttributeDeep()
    • testClonePIShallow()
    • testClonePIDeep()
    • testCloneNodeEntity()
    • testSiblings()
    • testEncodings()
    • testRenameAttribute()
    • testSchemaType()
    • testSetIdAttribute()
    • testSetIdAttributeNS()
    • testSetIdAttributeNode()
    • testExceptionOnSpacesInXMLNSValue()
    • test_minidom_attribute_order()
    • test_toxml_with_attributes_ordered()
    • test_toprettyxml_with_attributes_ordered()
    • test_toprettyxml_with_cdata()

Lib/test/test_pyexpat.py

  • class ParseTest:
    • test_parse_bytes()
    • test_parse_str()
    • test_parse_file()
    • test_parse_again()
    • test_supported_encodings()
    • test_supported_encodings2()
    • test_unsupported_encodings() AssertionError: ValueError not raised
    • test_incompatible_encodings() AssertionError: ExpatError not raised
    • test_non_text_encodings() AssertionError: LookupError not raised
    • test_undefined_encoding() AssertionError: UnicodeError not raised
    • test_unknown_encoding() AssertionError: LookupError not raised
  • class NamespaceSeparatorTest:
    • test_illegal()
  • class InterningTest:
    • test()
    • test_issue9402()
  • class BufferTextTest:
    • test_buffering_enabled()
    • test1()
    • test2()
    • test7()
  • class sf1296433Test:
    • test_parse_only_xml_data() TypeError: Expected type 'str' but 'bytes' found.
  • class ChardataBufferTest:
    • test_1025_bytes()
    • test_1000_bytes()
    • test_wrong_size()
    • test_unchanged_size()
    • test_disabling_buffer()
    • test_change_size_1()
    • test_change_size_2()
  • class ElementDeclHandlerTest:
    • test_trigger_leak() AssertionError: TypeError not raised by Parse
    • test_deeply_nested_content_model() AssertionError: RecursionError not raised
  • class MalformedInputTest:
    • test1()
    • test2()
  • class ErrorMessageTest:
    • test_codes()
    • test_expaterror()
  • class ForeignDTDTest:
    • test_use_foreign_dtd()
    • test_ignore_use_foreign_dtd()
  • class ParentParserLifetimeTest:
    • test_parent_parser_outlives_its_subparsers__single() AttributeError: 'xmlparser' object has no attribute 'ExternalEntityParserCreate'
    • test_parent_parser_outlives_its_subparsers__multiple() AttributeError: 'xmlparser' object has no attribute 'ExternalEntityParserCreate'
    • test_parent_parser_outlives_its_subparsers__chain() AttributeError: 'xmlparser' object has no attribute 'ExternalEntityParserCreate'
  • class ReparseDeferralTest:
    • test_getter_setter_round_trip() AttributeError: 'xmlparser' object has no attribute 'GetReparseDeferralEnabled'
    • test_reparse_deferral_enabled() AttributeError: 'xmlparser' object has no attribute 'GetReparseDeferralEnabled'
    • test_reparse_deferral_disabled() AttributeError: 'xmlparser' object has no attribute 'SetReparseDeferralEnabled'
  • class ExpansionProtectionTest: [N.B. this gets appended at the end of the current list]
    • test_set_activation_threshold__threshold_reached() AttributeError: 'xmlparser' object has no attribute 'SetBillionLaughsAttackProtectionMaximumAmplification'
    • test_set_activation_threshold__threshold_not_reached() AttributeError: 'xmlparser' object has no attribute 'SetBillionLaughsAttackProtectionMaximumAmplification'
    • test_set_maximum_amplification__amplification_exceeded() AttributeError: 'xmlparser' object has no attribute 'SetBillionLaughsAttackProtectionMaximumAmplification'
    • test_set_maximum_amplification__amplification_not_exceeded() AttributeError: 'xmlparser' object has no attribute 'SetBillionLaughsAttackProtectionMaximumAmplification'
    • test_set_activation_threshold__fail_for_subparser() AttributeError: 'xmlparser' object has no attribute 'SetBillionLaughsAttackProtectionMaximumAmplification'
    • test_set_activation_threshold__invalid_threshold_type() AttributeError: 'xmlparser' object has no attribute 'SetBillionLaughsAttackProtectionMaximumAmplification'
    • test_set_maximum_amplification__fail_for_subparser() AttributeError: 'xmlparser' object has no attribute 'SetBillionLaughsAttackProtectionMaximumAmplification'
    • test_set_maximum_amplification__infinity() AttributeError: 'xmlparser' object has no attribute 'SetBillionLaughsAttackProtectionMaximumAmplification'
    • test_set_maximum_amplification__invalid_max_factor_range() AttributeError: 'xmlparser' object has no attribute 'SetBillionLaughsAttackProtectionMaximumAmplification'
    • test_set_maximum_amplification__invalid_max_factor_type() AttributeError: 'xmlparser' object has no attribute 'SetBillionLaughsAttackProtectionMaximumAmplification'

Lib/test/test_sax.py

  • class ParseTest:
    • test_parse_text() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'
    • test_parse_bytes() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'
    • test_parse_path_object() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'
    • test_parse_InputSource() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'
    • test_parse_close_source() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'
    • check_parseString() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'
      N.B. erroneous?
    • test_parseString_text() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'
    • test_parseString_bytes() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'
  • class XmlGenTest:
    • test_5027_1() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'
  • class ExpatReaderTest:
    • test_expat_binary_file() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'
    • test_expat_text_file() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'
    • test_expat_binary_file_nonascii() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'
    • test_expat_binary_file_bytes_name() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'
    • test_expat_binary_file_int_name() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'
    • test_expat_dtdhandler_support() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'
    • test_expat_external_dtd_enabled() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'
    • test_expat_external_dtd_default() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'
    • test_expat_entityresolver_enabled() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'
    • test_expat_entityresolver_default() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'
    • test_expat_attrs_empty() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'
    • test_expat_attrs_wattr() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'
    • test_expat_nsattrs_empty() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'
    • test_expat_nsattrs_wattr() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'
    • test_expat_inpsource_filename() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'
    • test_expat_inpsource_sysid() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'
    • test_expat_inpsource_sysid_nonascii() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'
    • test_expat_inpsource_byte_stream() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'
    • test_expat_inpsource_character_stream() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'
    • test_expat_incremental() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'
    • test_expat_incremental_reset() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'
    • test_flush_reparse_deferral_enabled() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'
    • test_flush_reparse_deferral_disabled() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'
    • test_expat_locator_noinfo() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'
    • test_expat_locator_withinfo() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'
    • test_expat_locator_withinfo_nonascii() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'
  • class ErrorReportingTest:
    • test_expat_inpsource_location() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'
    • test_expat_incomplete() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'
  • class LexicalHandlerTest:
    • test_handlers() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'
  • class CDATAHandlerTest:
    • test_handlers() AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'

Lib/test/test_xml_dom_minicompat.py

No tests fail.

Lib/test/test_xml_dom_xmlbuilder.py

No tests fail.

Lib/test/test_xml_etree.py

  • class ElementTreeTest:
    • test_file_init()
    • test_parsefile()
    • test_parseliteral()
    • test_custom_builder()
    • test_custom_builder_only_end_ns()
    • test_children()
    • test_encoding()
    • test_entity()
    • test_namespace()
    • test_attlist_default()
  • class IterparseTest:
    • test_basic()
    • test_external_file()
    • test_events()
    • test_namespace_events()
    • test_non_utf8()
    • test_parsing_error()
    • test_resource_warnings_not_exhausted()
    • test_resource_warnings_failed_iteration()
    • test_close_not_exhausted()
  • class XMLPullParserTest:
    • test_simple_xml()
    • test_simple_xml_chunk_1()
    • test_simple_xml_chunk_5()
    • test_simple_xml_chunk_22()
    • test_feed_while_iterating()
    • test_simple_xml_with_ns()
    • test_ns_events()
    • test_ns_events_start()
    • test_ns_events_start_end()
    • test_events()
    • test_events_comment()
    • test_events_pi()
    • test_flush_reparse_deferral_enabled()
    • test_flush_reparse_deferral_disabled()
    • test_xinclude_default()
    • test_xinclude()
    • test_xinclude_repeated()
    • test_xinclude_failures()
  • class BugsTest:
    • test_bug_xmltoolkit25()
    • test_bug_xmltoolkit39()
    • test_bug_xmltoolkit55()
    • test_bug_xmltoolkit63()
    • test_bug_200708_newline()
    • test_issue6565()
    • test_lost_elem()
    • test_expat224_utf8_bug()
    • test_expat224_utf8_bug_file()
  • class BadElementTest:
    • test_deeply_nested_deepcopy()
  • class ElementFindTest:
    • test_find_simple()
    • test_find_xpath()
    • test_findall()
    • test_find_through_ElementTree()
  • class TreeBuilderTest:
    • test_late_tail_mix_pi_comments()
    • test_doctype()
  • class XMLParserTest:
    • test_subclass_doctype()
    • test_parse_string()
  • class ParseErrorTest:
    • test_error_position()
    • test_error_code()
  • class BoolTest:
    • test_warning()
  • class C14NTest:
    • test_simple_roundtrip()
    • test_c14n_exclusion()
    • test_xml_c14n2()

Lib/test/test_xml_etree_c.py

No tests fail.

Lib/test/test_xmlrpc.py

  • class XMLRPCTestCase:
    • test_dump_encoding()
    • test_loads_unsupported()
    • test_load_extension_types()
  • class SimpleServerTestCase:
    • test_client_encoding()
  • class SimpleServerEncodingTestCase:
    • test_server_encoding()