Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some tests error out with typing_extensions>=4.12 #227

Closed
devdanzin opened this issue Jun 12, 2024 · 0 comments · Fixed by #229
Closed

Some tests error out with typing_extensions>=4.12 #227

devdanzin opened this issue Jun 12, 2024 · 0 comments · Fixed by #229
Labels
bug Something isn't working

Comments

@devdanzin
Copy link

  • mashumaro version: 3.13 (bffc024)
  • Python version: 3.12, 3.11
  • Operating System: Linux (WSL)

Description

Trying to run the tests with typing_extensions>=4.12 (released 3 weeks ago) results in about 10 errors with message mashumaro.exceptions.UnserializableDataError: typing_extensions.NoDefault as a field type is not supported by mashumaro. With typing_extensions==4.11 the tests are collected without errors.

The relevant changelog entry is:

Backport the typing.NoDefault sentinel object from Python 3.13. TypeVars, ParamSpecs and TypeVarTuples without default values now have their default attribute set to this sentinel value.

What I Did

pytest
=========================================== test session starts ============================================
platform linux -- Python 3.11.0rc1, pytest-8.2.0, pluggy-1.5.0
rootdir: /home/danzin/projects/mashumaro
configfile: pyproject.toml
plugins: mock-3.14.0, time-machine-2.14.1, flaky-3.8.1, hypothesis-6.100.2, xdist-3.5.0, cov-5.0.0
collected 318 items / 10 errors

================================================== ERRORS ==================================================
__________________________ ERROR collecting tests/test_codecs/test_basic_codec.py __________________________
tests/test_codecs/test_basic_codec.py:11: in <module>
    from tests.entities import (
tests/entities.py:207: in <module>
    class MyGenericDataClass(Generic[T], DataClassDictMixin):
/usr/lib/python3.11/typing.py:1823: in __init_subclass__
    super().__init_subclass__(*args, **kwargs)
mashumaro/mixins/dict.py:25: in __init_subclass__
    compile_mixin_unpacker(cls, **builder_params["unpacker"])
mashumaro/core/meta/mixin.py:49: in compile_mixin_unpacker
    builder.add_unpack_method()
mashumaro/core/meta/code/builder.py:586: in add_unpack_method
    self._add_unpack_method_lines(method_name)
mashumaro/core/meta/code/builder.py:491: in _add_unpack_method_lines
    ).build(
mashumaro/core/meta/code/builder.py:1332: in build
    unpacked_value = UnpackerRegistry.get(
mashumaro/core/meta/types/common.py:238: in get
    expr = packer(spec)
mashumaro/core/meta/types/unpack.py:756: in unpack_special_typing_primitive
    uv = UnpackerRegistry.get(spec.copy(type=bound))
mashumaro/core/meta/types/common.py:238: in get
    expr = packer(spec)
mashumaro/core/meta/types/unpack.py:830: in unpack_special_typing_primitive
    raise UnserializableDataError(
E   mashumaro.exceptions.UnserializableDataError: typing_extensions.NoDefault as a field type is not supported by mashumaro
__________________________________ ERROR collecting tests/test_config.py ___________________________________
tests/test_config.py:12: in <module>
    from .entities import (
tests/entities.py:207: in <module>
    class MyGenericDataClass(Generic[T], DataClassDictMixin):
/usr/lib/python3.11/typing.py:1823: in __init_subclass__
    super().__init_subclass__(*args, **kwargs)
mashumaro/mixins/dict.py:25: in __init_subclass__
    compile_mixin_unpacker(cls, **builder_params["unpacker"])
mashumaro/core/meta/mixin.py:49: in compile_mixin_unpacker
    builder.add_unpack_method()
mashumaro/core/meta/code/builder.py:586: in add_unpack_method
    self._add_unpack_method_lines(method_name)
mashumaro/core/meta/code/builder.py:491: in _add_unpack_method_lines
    ).build(
mashumaro/core/meta/code/builder.py:1332: in build
    unpacked_value = UnpackerRegistry.get(
mashumaro/core/meta/types/common.py:238: in get
    expr = packer(spec)
mashumaro/core/meta/types/unpack.py:756: in unpack_special_typing_primitive
    uv = UnpackerRegistry.get(spec.copy(type=bound))
mashumaro/core/meta/types/common.py:238: in get
    expr = packer(spec)
mashumaro/core/meta/types/unpack.py:830: in unpack_special_typing_primitive
    raise UnserializableDataError(
E   mashumaro.exceptions.UnserializableDataError: typing_extensions.NoDefault as a field type is not supported by mashumaro
________________________________ ERROR collecting tests/test_data_types.py _________________________________
tests/test_data_types.py:63: in <module>
    from tests.entities import MyUntypedNamedTupleWithDefaults
tests/entities.py:207: in <module>
    class MyGenericDataClass(Generic[T], DataClassDictMixin):
/usr/lib/python3.11/typing.py:1823: in __init_subclass__
    super().__init_subclass__(*args, **kwargs)
mashumaro/mixins/dict.py:25: in __init_subclass__
    compile_mixin_unpacker(cls, **builder_params["unpacker"])
mashumaro/core/meta/mixin.py:49: in compile_mixin_unpacker
    builder.add_unpack_method()
mashumaro/core/meta/code/builder.py:586: in add_unpack_method
    self._add_unpack_method_lines(method_name)
mashumaro/core/meta/code/builder.py:491: in _add_unpack_method_lines
    ).build(
mashumaro/core/meta/code/builder.py:1332: in build
    unpacked_value = UnpackerRegistry.get(
mashumaro/core/meta/types/common.py:238: in get
    expr = packer(spec)
mashumaro/core/meta/types/unpack.py:756: in unpack_special_typing_primitive
    uv = UnpackerRegistry.get(spec.copy(type=bound))
mashumaro/core/meta/types/common.py:238: in get
    expr = packer(spec)
mashumaro/core/meta/types/unpack.py:830: in unpack_special_typing_primitive
    raise UnserializableDataError(
E   mashumaro.exceptions.UnserializableDataError: typing_extensions.NoDefault as a field type is not supported by mashumaro
_________________________________ ERROR collecting tests/test_generics.py __________________________________
tests/test_generics.py:7: in <module>
    from tests.entities import MyGenericDataClass, SerializableTypeGenericList
tests/entities.py:207: in <module>
    class MyGenericDataClass(Generic[T], DataClassDictMixin):
/usr/lib/python3.11/typing.py:1823: in __init_subclass__
    super().__init_subclass__(*args, **kwargs)
mashumaro/mixins/dict.py:25: in __init_subclass__
    compile_mixin_unpacker(cls, **builder_params["unpacker"])
mashumaro/core/meta/mixin.py:49: in compile_mixin_unpacker
    builder.add_unpack_method()
mashumaro/core/meta/code/builder.py:586: in add_unpack_method
    self._add_unpack_method_lines(method_name)
mashumaro/core/meta/code/builder.py:491: in _add_unpack_method_lines
    ).build(
mashumaro/core/meta/code/builder.py:1332: in build
    unpacked_value = UnpackerRegistry.get(
mashumaro/core/meta/types/common.py:238: in get
    expr = packer(spec)
mashumaro/core/meta/types/unpack.py:756: in unpack_special_typing_primitive
    uv = UnpackerRegistry.get(spec.copy(type=bound))
mashumaro/core/meta/types/common.py:238: in get
    expr = packer(spec)
mashumaro/core/meta/types/unpack.py:830: in unpack_special_typing_primitive
    raise UnserializableDataError(
E   mashumaro.exceptions.UnserializableDataError: typing_extensions.NoDefault as a field type is not supported by mashumaro
___________________________________ ERROR collecting tests/test_json.py ____________________________________
tests/test_json.py:11: in <module>
    from .entities import MyEnum
tests/entities.py:207: in <module>
    class MyGenericDataClass(Generic[T], DataClassDictMixin):
/usr/lib/python3.11/typing.py:1823: in __init_subclass__
    super().__init_subclass__(*args, **kwargs)
mashumaro/mixins/dict.py:25: in __init_subclass__
    compile_mixin_unpacker(cls, **builder_params["unpacker"])
mashumaro/core/meta/mixin.py:49: in compile_mixin_unpacker
    builder.add_unpack_method()
mashumaro/core/meta/code/builder.py:586: in add_unpack_method
    self._add_unpack_method_lines(method_name)
mashumaro/core/meta/code/builder.py:491: in _add_unpack_method_lines
    ).build(
mashumaro/core/meta/code/builder.py:1332: in build
    unpacked_value = UnpackerRegistry.get(
mashumaro/core/meta/types/common.py:238: in get
    expr = packer(spec)
mashumaro/core/meta/types/unpack.py:756: in unpack_special_typing_primitive
    uv = UnpackerRegistry.get(spec.copy(type=bound))
mashumaro/core/meta/types/common.py:238: in get
    expr = packer(spec)
mashumaro/core/meta/types/unpack.py:830: in unpack_special_typing_primitive
    raise UnserializableDataError(
E   mashumaro.exceptions.UnserializableDataError: typing_extensions.NoDefault as a field type is not supported by mashumaro
___________________ ERROR collecting tests/test_jsonschema/test_jsonschema_generation.py ___________________
tests/test_jsonschema/test_jsonschema_generation.py:77: in <module>
    from tests.entities import (
tests/entities.py:207: in <module>
    class MyGenericDataClass(Generic[T], DataClassDictMixin):
/usr/lib/python3.11/typing.py:1823: in __init_subclass__
    super().__init_subclass__(*args, **kwargs)
mashumaro/mixins/dict.py:25: in __init_subclass__
    compile_mixin_unpacker(cls, **builder_params["unpacker"])
mashumaro/core/meta/mixin.py:49: in compile_mixin_unpacker
    builder.add_unpack_method()
mashumaro/core/meta/code/builder.py:586: in add_unpack_method
    self._add_unpack_method_lines(method_name)
mashumaro/core/meta/code/builder.py:491: in _add_unpack_method_lines
    ).build(
mashumaro/core/meta/code/builder.py:1332: in build
    unpacked_value = UnpackerRegistry.get(
mashumaro/core/meta/types/common.py:238: in get
    expr = packer(spec)
mashumaro/core/meta/types/unpack.py:756: in unpack_special_typing_primitive
    uv = UnpackerRegistry.get(spec.copy(type=bound))
mashumaro/core/meta/types/common.py:238: in get
    expr = packer(spec)
mashumaro/core/meta/types/unpack.py:830: in unpack_special_typing_primitive
    raise UnserializableDataError(
E   mashumaro.exceptions.UnserializableDataError: typing_extensions.NoDefault as a field type is not supported by mashumaro
__________________________________ ERROR collecting tests/test_literal.py __________________________________
tests/test_literal.py:11: in <module>
    from tests.entities import MyEnum
tests/entities.py:207: in <module>
    class MyGenericDataClass(Generic[T], DataClassDictMixin):
/usr/lib/python3.11/typing.py:1823: in __init_subclass__
    super().__init_subclass__(*args, **kwargs)
mashumaro/mixins/dict.py:25: in __init_subclass__
    compile_mixin_unpacker(cls, **builder_params["unpacker"])
mashumaro/core/meta/mixin.py:49: in compile_mixin_unpacker
    builder.add_unpack_method()
mashumaro/core/meta/code/builder.py:586: in add_unpack_method
    self._add_unpack_method_lines(method_name)
mashumaro/core/meta/code/builder.py:491: in _add_unpack_method_lines
    ).build(
mashumaro/core/meta/code/builder.py:1332: in build
    unpacked_value = UnpackerRegistry.get(
mashumaro/core/meta/types/common.py:238: in get
    expr = packer(spec)
mashumaro/core/meta/types/unpack.py:756: in unpack_special_typing_primitive
    uv = UnpackerRegistry.get(spec.copy(type=bound))
mashumaro/core/meta/types/common.py:238: in get
    expr = packer(spec)
mashumaro/core/meta/types/unpack.py:830: in unpack_special_typing_primitive
    raise UnserializableDataError(
E   mashumaro.exceptions.UnserializableDataError: typing_extensions.NoDefault as a field type is not supported by mashumaro
___________________________________ ERROR collecting tests/test_meta.py ____________________________________
tests/test_meta.py:63: in <module>
    from .entities import (
tests/entities.py:207: in <module>
    class MyGenericDataClass(Generic[T], DataClassDictMixin):
/usr/lib/python3.11/typing.py:1823: in __init_subclass__
    super().__init_subclass__(*args, **kwargs)
mashumaro/mixins/dict.py:25: in __init_subclass__
    compile_mixin_unpacker(cls, **builder_params["unpacker"])
mashumaro/core/meta/mixin.py:49: in compile_mixin_unpacker
    builder.add_unpack_method()
mashumaro/core/meta/code/builder.py:586: in add_unpack_method
    self._add_unpack_method_lines(method_name)
mashumaro/core/meta/code/builder.py:491: in _add_unpack_method_lines
    ).build(
mashumaro/core/meta/code/builder.py:1332: in build
    unpacked_value = UnpackerRegistry.get(
mashumaro/core/meta/types/common.py:238: in get
    expr = packer(spec)
mashumaro/core/meta/types/unpack.py:756: in unpack_special_typing_primitive
    uv = UnpackerRegistry.get(spec.copy(type=bound))
mashumaro/core/meta/types/common.py:238: in get
    expr = packer(spec)
mashumaro/core/meta/types/unpack.py:830: in unpack_special_typing_primitive
    raise UnserializableDataError(
E   mashumaro.exceptions.UnserializableDataError: typing_extensions.NoDefault as a field type is not supported by mashumaro
_____________________________ ERROR collecting tests/test_metadata_options.py ______________________________
tests/test_metadata_options.py:18: in <module>
    from .entities import (
tests/entities.py:207: in <module>
    class MyGenericDataClass(Generic[T], DataClassDictMixin):
/usr/lib/python3.11/typing.py:1823: in __init_subclass__
    super().__init_subclass__(*args, **kwargs)
mashumaro/mixins/dict.py:25: in __init_subclass__
    compile_mixin_unpacker(cls, **builder_params["unpacker"])
mashumaro/core/meta/mixin.py:49: in compile_mixin_unpacker
    builder.add_unpack_method()
mashumaro/core/meta/code/builder.py:586: in add_unpack_method
    self._add_unpack_method_lines(method_name)
mashumaro/core/meta/code/builder.py:491: in _add_unpack_method_lines
    ).build(
mashumaro/core/meta/code/builder.py:1332: in build
    unpacked_value = UnpackerRegistry.get(
mashumaro/core/meta/types/common.py:238: in get
    expr = packer(spec)
mashumaro/core/meta/types/unpack.py:756: in unpack_special_typing_primitive
    uv = UnpackerRegistry.get(spec.copy(type=bound))
mashumaro/core/meta/types/common.py:238: in get
    expr = packer(spec)
mashumaro/core/meta/types/unpack.py:830: in unpack_special_typing_primitive
    raise UnserializableDataError(
E   mashumaro.exceptions.UnserializableDataError: typing_extensions.NoDefault as a field type is not supported by mashumaro
___________________________________ ERROR collecting tests/test_types.py ___________________________________
tests/test_types.py:12: in <module>
    from tests.entities import GenericSerializableList, GenericSerializableWrapper
tests/entities.py:207: in <module>
    class MyGenericDataClass(Generic[T], DataClassDictMixin):
/usr/lib/python3.11/typing.py:1823: in __init_subclass__
    super().__init_subclass__(*args, **kwargs)
mashumaro/mixins/dict.py:25: in __init_subclass__
    compile_mixin_unpacker(cls, **builder_params["unpacker"])
mashumaro/core/meta/mixin.py:49: in compile_mixin_unpacker
    builder.add_unpack_method()
mashumaro/core/meta/code/builder.py:586: in add_unpack_method
    self._add_unpack_method_lines(method_name)
mashumaro/core/meta/code/builder.py:491: in _add_unpack_method_lines
    ).build(
mashumaro/core/meta/code/builder.py:1332: in build
    unpacked_value = UnpackerRegistry.get(
mashumaro/core/meta/types/common.py:238: in get
    expr = packer(spec)
mashumaro/core/meta/types/unpack.py:756: in unpack_special_typing_primitive
    uv = UnpackerRegistry.get(spec.copy(type=bound))
mashumaro/core/meta/types/common.py:238: in get
    expr = packer(spec)
mashumaro/core/meta/types/unpack.py:830: in unpack_special_typing_primitive
    raise UnserializableDataError(
E   mashumaro.exceptions.UnserializableDataError: typing_extensions.NoDefault as a field type is not supported by mashumaro
========================================= short test summary info ==========================================
ERROR tests/test_codecs/test_basic_codec.py - mashumaro.exceptions.UnserializableDataError: typing_extensions.NoDefault as a field type is not suppor...
ERROR tests/test_config.py - mashumaro.exceptions.UnserializableDataError: typing_extensions.NoDefault as a field type is not suppor...
ERROR tests/test_data_types.py - mashumaro.exceptions.UnserializableDataError: typing_extensions.NoDefault as a field type is not suppor...
ERROR tests/test_generics.py - mashumaro.exceptions.UnserializableDataError: typing_extensions.NoDefault as a field type is not suppor...
ERROR tests/test_json.py - mashumaro.exceptions.UnserializableDataError: typing_extensions.NoDefault as a field type is not suppor...
ERROR tests/test_jsonschema/test_jsonschema_generation.py - mashumaro.exceptions.UnserializableDataError: typing_extensions.NoDefault as a field type is not suppor...
ERROR tests/test_literal.py - mashumaro.exceptions.UnserializableDataError: typing_extensions.NoDefault as a field type is not suppor...
ERROR tests/test_meta.py - mashumaro.exceptions.UnserializableDataError: typing_extensions.NoDefault as a field type is not suppor...
ERROR tests/test_metadata_options.py - mashumaro.exceptions.UnserializableDataError: typing_extensions.NoDefault as a field type is not suppor...
ERROR tests/test_types.py - mashumaro.exceptions.UnserializableDataError: typing_extensions.NoDefault as a field type is not suppor...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 10 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================ 10 errors in 4.80s ============================================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants