Skip to content

Python 3.12 support #342

@bluetech

Description

@bluetech

Hi, I'm a pytest dev working on adding initial support for Python 3.12 alpha to pytest. pytest uses xmlschema in its testsuite. Importing xmlschema fails on 3.12:

testing/test_junitxml.py:13: in <module>
    import xmlschema
.tox/py312/lib/python3.12/site-packages/xmlschema/__init__.py:21: in <module>
    from .dataobjects import DataElement, DataElementConverter, DataBindingConverter
.tox/py312/lib/python3.12/site-packages/xmlschema/dataobjects.py:24: in <module>
    from . import validators
.tox/py312/lib/python3.12/site-packages/xmlschema/validators/__init__.py:38: in <module>
    from .schemas import XMLSchemaMeta, XMLSchemaBase, XMLSchema, XMLSchema10, XMLSchema11
.tox/py312/lib/python3.12/site-packages/xmlschema/validators/schemas.py:2183: in <module>
    class XMLSchema10(XMLSchemaBase):
.tox/py312/lib/python3.12/site-packages/xmlschema/validators/schemas.py:134: in __new__
    meta_schema = meta_schema_class.create_meta_schema(meta_schema_file)
.tox/py312/lib/python3.12/site-packages/xmlschema/validators/schemas.py:768: in create_meta_schema
    meta_schema = meta_schema_class(source, XSD_NAMESPACE, defuse='never', build=False)
.tox/py312/lib/python3.12/site-packages/xmlschema/validators/schemas.py:345: in __init__
    self.source = XMLResource(source, base_url, allow, defuse, timeout)
.tox/py312/lib/python3.12/site-packages/xmlschema/resources.py:470: in __init__
    self.parse(source, lazy)
.tox/py312/lib/python3.12/site-packages/xmlschema/resources.py:728: in parse
    url = normalize_url(source, self._base_url)
.tox/py312/lib/python3.12/site-packages/xmlschema/resources.py:144: in normalize_url
    path = _PurePath.from_uri(url)
.tox/py312/lib/python3.12/site-packages/xmlschema/resources.py:65: in from_uri
    return cls(uri)
.tox/py312/lib/python3.12/site-packages/xmlschema/resources.py:54: in __new__
    return cast('_PurePath', cls._from_parts(args))
E   AttributeError: type object '_PurePosixPath' has no attribute '_from_parts'. Did you mean: '_load_parts'?

Looks like pathlib removed the private _from_parts function.

I tried running the xmlschema testsuite on py3.12, however that currently fails because xmlschema's testsuite depends on lxml which fails to compile on py3.12 (because of cython). So might need to wait for lxml/cython here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions