Skip to content

XML-related test failures #8083

Description

@fanninpm

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:
    • test_basic() read from stream io
  • class PullDOMTestCase:
    • test_parse() FileNotFoundError: [Errno 2] No such file or directory (os error 2): 'xmltestdata/test.xml' -> 'None'
    • test_parse_semantics() implement DOM semantic
    • test_expandItem() pulldom.parseString(SMALL_SAMPLE) return iterator with tuple with 2 elements

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

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()

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-compatA discrepancy between RustPython and CPython

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions