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
Lib/test/test_pulldom.py
- class
SAX2DOMTestCase:
- class
PullDOMTestCase:
Lib/test/test_pyexpat.py
- class
ParseTest:
- class
NamespaceSeparatorTest:
- class
InterningTest:
- class
BufferTextTest:
- class
sf1296433Test:
- class
ChardataBufferTest:
- class
ElementDeclHandlerTest:
- class
MalformedInputTest:
- class
ErrorMessageTest:
- class
ForeignDTDTest:
- class
ParentParserLifetimeTest:
- class
ReparseDeferralTest:
- class
ExpansionProtectionTest: [N.B. this gets appended at the end of the current list]
Lib/test/test_sax.py
- class
ParseTest:
- class
XmlGenTest:
- class
ExpatReaderTest:
- class
ErrorReportingTest:
- class
LexicalHandlerTest:
- class
CDATAHandlerTest:
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:
- class
IterparseTest:
- class
XMLPullParserTest:
- class
BugsTest:
- class
BadElementTest:
- class
ElementFindTest:
- class
TreeBuilderTest:
- class
XMLParserTest:
- class
ParseErrorTest:
- class
BoolTest:
- class
C14NTest:
Lib/test/test_xml_etree_c.py
No tests fail.
Lib/test/test_xmlrpc.py
- class
XMLRPCTestCase:
- class
SimpleServerTestCase:
- class
SimpleServerEncodingTestCase:
I want to push more on getting RustPython's XML capabilities on par with CPython's, so we can replace
extratests/json-tests.pywith a more robust solution involving CPython's own test harness (the--junit-xmlflag onpython -m test). A lot of this may involve making thexmlcrate "behave" more like thelibexpatparser. 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.xmltestswill output valid XML. Here's the current state of play (as of 14 June 2026):Lib/test/test_minidom.pyMinidomTest:testGetElementsByTagNameNS()testWriteXML()Implement pyexpat ordered_attributes #8305testAltNewline()Implement pyexpat ordered_attributes #8305testProcessingInstruction()testProcessingInstructionRepr()testRemoveNamedItem()Implement pyexpat ordered_attributes #8305testRemoveNamedItemNS()Implement pyexpat ordered_attributes #8305testCloneElementShallow()Implement pyexpat ordered_attributes #8305testCloneAttributeShallow()Implement pyexpat ordered_attributes #8305testCloneAttributeDeep()Implement pyexpat ordered_attributes #8305testClonePIShallow()testClonePIDeep()testCloneNodeEntity()testSiblings()testEncodings()testRenameAttribute()Implement pyexpat ordered_attributes #8305testSchemaType()Implement pyexpat ordered_attributes #8305testSetIdAttribute()Implement pyexpat ordered_attributes #8305testSetIdAttributeNS()Implement pyexpat ordered_attributes #8305testSetIdAttributeNode()testExceptionOnSpacesInXMLNSValue()test_minidom_attribute_order()Implement pyexpat ordered_attributes #8305test_toxml_with_attributes_ordered()Implement pyexpat ordered_attributes #8305test_toprettyxml_with_attributes_ordered()Implement pyexpat ordered_attributes #8305test_toprettyxml_with_cdata()Lib/test/test_pulldom.pySAX2DOMTestCase:test_basic()read from stream ioPullDOMTestCase:test_parse()FileNotFoundError: [Errno 2] No such file or directory (os error 2): 'xmltestdata/test.xml' -> 'None'test_parse_semantics()implement DOM semantictest_expandItem()pulldom.parseString(SMALL_SAMPLE) return iterator with tuple with 2 elementsLib/test/test_pyexpat.pyParseTest:test_parse_bytes()test_parse_str()test_parse_file()test_parse_again()test_supported_encodings()test_supported_encodings2()test_unsupported_encodings()AssertionError: ValueError not raisedtest_incompatible_encodings()AssertionError: ExpatError not raisedtest_non_text_encodings()AssertionError: LookupError not raisedtest_undefined_encoding()AssertionError: UnicodeError not raisedtest_unknown_encoding()AssertionError: LookupError not raisedNamespaceSeparatorTest:test_illegal()InterningTest:test()test_issue9402()BufferTextTest:test_buffering_enabled()test1()test2()test7()sf1296433Test:test_parse_only_xml_data()TypeError: Expected type 'str' but 'bytes' found.ChardataBufferTest:test_1025_bytes()test_1000_bytes()test_wrong_size()test_unchanged_size()test_disabling_buffer()test_change_size_1()test_change_size_2()ElementDeclHandlerTest:test_trigger_leak()AssertionError: TypeError not raised by Parsetest_deeply_nested_content_model()AssertionError: RecursionError not raisedMalformedInputTest:test1()test2()ErrorMessageTest:test_codes()test_expaterror()ForeignDTDTest:test_use_foreign_dtd()test_ignore_use_foreign_dtd()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'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'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.pyParseTest: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'XmlGenTest:test_5027_1()AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'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'ErrorReportingTest:test_expat_inpsource_location()AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'test_expat_incomplete()AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'LexicalHandlerTest:test_handlers()AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'CDATAHandlerTest:test_handlers()AttributeError: 'xmlparser' object has no attribute 'SetParamEntityParsing'Lib/test/test_xml_dom_minicompat.pyNo tests fail.
Lib/test/test_xml_dom_xmlbuilder.pyNo tests fail.
Lib/test/test_xml_etree.pyElementTreeTest:test_file_init()Implement pyexpat ordered_attributes #8305test_parsefile()Implement pyexpat ordered_attributes #8305test_parseliteral()test_custom_builder()test_custom_builder_only_end_ns()test_children()Implement pyexpat ordered_attributes #8305test_encoding()test_entity()test_namespace()Implement pyexpat ordered_attributes #8305test_attlist_default()IterparseTest:test_basic()Implement pyexpat ordered_attributes #8305test_external_file()Implement pyexpat ordered_attributes #8305test_events()Implement pyexpat ordered_attributes #8305test_namespace_events()test_non_utf8()test_parsing_error()test_resource_warnings_not_exhausted()Implement pyexpat ordered_attributes #8305test_resource_warnings_failed_iteration()test_close_not_exhausted()Implement pyexpat ordered_attributes #8305XMLPullParserTest: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()Implement pyexpat ordered_attributes #8305test_xinclude()Implement pyexpat ordered_attributes #8305test_xinclude_repeated()Implement pyexpat ordered_attributes #8305test_xinclude_failures()Implement pyexpat ordered_attributes #8305BugsTest:test_bug_xmltoolkit25()Implement pyexpat ordered_attributes #8305test_bug_xmltoolkit39()Implement pyexpat ordered_attributes #8305test_bug_xmltoolkit55()test_bug_xmltoolkit63()test_bug_200708_newline()Implement pyexpat ordered_attributes #8305test_issue6565()Implement pyexpat ordered_attributes #8305test_lost_elem()test_expat224_utf8_bug()Implement pyexpat ordered_attributes #8305test_expat224_utf8_bug_file()BadElementTest:test_deeply_nested_deepcopy()ElementFindTest:test_find_simple()Implement pyexpat ordered_attributes #8305test_find_xpath()Implement pyexpat ordered_attributes #8305test_findall()Implement pyexpat ordered_attributes #8305test_find_through_ElementTree()Implement pyexpat ordered_attributes #8305TreeBuilderTest:test_late_tail_mix_pi_comments()test_doctype()XMLParserTest:test_subclass_doctype()test_parse_string()ParseErrorTest:test_error_position()test_error_code()BoolTest:test_warning()Implement pyexpat ordered_attributes #8305C14NTest:test_simple_roundtrip()test_c14n_exclusion()test_xml_c14n2()Lib/test/test_xml_etree_c.pyNo tests fail.
Lib/test/test_xmlrpc.pyXMLRPCTestCase:test_dump_encoding()test_loads_unsupported()test_load_extension_types()SimpleServerTestCase:test_client_encoding()SimpleServerEncodingTestCase:test_server_encoding()