python-attrs / cattrs

Composable custom class converters for attrs, dataclasses and friends.
https://catt.rs
MIT License
791 stars 110 forks source link

23.1.2: pytest is failing #439

Closed kloczek closed 10 months ago

kloczek commented 10 months ago

Description

I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

Here is pytest output:

```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-cattrs-23.1.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-cattrs-23.1.2-2.fc35.x86_64/usr/lib/python3.8/site-packages + /usr/bin/pytest -ra -m 'not network' ==================================================================================== test session starts ==================================================================================== platform linux -- Python 3.8.18, pytest-7.4.3, pluggy-1.3.0 benchmark: 4.0.0 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=True warmup_iterations=5) rootdir: /home/tkloczko/rpmbuild/BUILD/cattrs-23.1.2 configfile: pyproject.toml plugins: hypothesis-6.84.3, benchmark-4.0.0 collected 415 items / 1 error ========================================================================================== ERRORS =========================================================================================== __________________________________________________________________________ ERROR collecting tests/test_preconf.py ___________________________________________________________________________ ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/cattrs-23.1.2/tests/test_preconf.py'. Hint: make sure your test modules/packages have valid Python names. Traceback: /usr/lib64/python3.8/importlib/__init__.py:127: in import_module return _bootstrap._gcd_import(name[level:], package, level) tests/test_preconf.py:10: in from bson import CodecOptions, ObjectId E ImportError: cannot import name 'CodecOptions' from 'bson' (/usr/lib/python3.8/site-packages/bson/__init__.py) ================================================================================== short test summary info ================================================================================== ERROR tests/test_preconf.py !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ===================================================================================== 1 error in 0.94s ====================================================================================== ```

Here is list of installed modules in build env

```console Package Version ----------------------------- ------- alabaster 0.7.13 attrs 23.1.0 Babel 2.13.1 bson 0.5.10 build 1.0.0 cbor2 5.5.0 charset-normalizer 3.3.1 cppclean 0.13 distro 1.8.0 docutils 0.20.1 exceptiongroup 1.1.3 gpg 1.22.0 hypothesis 6.84.3 idna 3.4 imagesize 1.4.1 immutables 0.20 importlib-metadata 6.8.0 iniconfig 2.0.0 installer 0.7.0 Jinja2 3.1.2 markdown-it-py 3.0.0 MarkupSafe 2.1.3 mdit-py-plugins 0.4.0 mdurl 0.1.2 msgpack 1.0.6 myst-parser 2.0.0 orjson 3.9.10 packaging 23.2 pluggy 1.3.0 poetry-core 1.7.0 py-cpuinfo 9.0.0 Pygments 2.16.1 pyproject_hooks 1.0.0 pytest 7.4.3 pytest-benchmark 4.0.0 python-dateutil 2.8.2 pytz 2023.3 PyYAML 6.0.1 requests 2.31.0 six 1.16.0 snowballstemmer 2.2.0 sortedcontainers 2.4.0 Sphinx 7.1.2 sphinx-copybutton 0.5.2 sphinxcontrib-applehelp 1.0.4 sphinxcontrib-devhelp 1.0.2 sphinxcontrib-htmlhelp 2.0.4 sphinxcontrib-jsmath 1.0.1 sphinxcontrib-qthelp 1.0.3 sphinxcontrib-serializinghtml 1.1.9 tomli 2.0.1 tomlkit 0.12.1 typing_extensions 4.8.0 ujson 5.8.0 urllib3 1.26.18 wheel 0.41.2 zipp 3.17.0 ```
kloczek commented 10 months ago

After add tests/test_preconf.py to --ignore list pytest is failing in four units

```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-cattrs-23.1.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-cattrs-23.1.2-2.fc35.x86_64/usr/lib/python3.8/site-packages + /usr/bin/pytest -ra -m 'not network' --ignore tests/test_preconf.py ==================================================================================== test session starts ==================================================================================== platform linux -- Python 3.8.18, pytest-7.4.3, pluggy-1.3.0 benchmark: 4.0.0 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=True warmup_iterations=5) rootdir: /home/tkloczko/rpmbuild/BUILD/cattrs-23.1.2 configfile: pyproject.toml plugins: hypothesis-6.84.3, benchmark-4.0.0 collected 415 items bench/test_attrs_collections.py .......... [ 2%] bench/test_attrs_nested.py ........ [ 4%] bench/test_attrs_primitives.py ........ [ 6%] bench/test_primitives.py .... [ 7%] tests/test_baseconverter.py .....s.s [ 9%] tests/test_converter.py ...........s.s.........s. [ 15%] tests/test_converter_inheritance.py ................ [ 19%] tests/test_copy.py ... [ 19%] tests/test_dataclasses.py ...... [ 21%] tests/test_factory_hooks.py . [ 21%] tests/test_gen_dict.py .... [ 22%] tests/test_generics.py .................... [ 27%] tests/test_unstructure.py .. [ 27%] tests/strategies/test_tagged_unions.py ............ [ 30%] tests/test_converter_inheritance.py ................ [ 34%] tests/test_copy.py ... [ 35%] tests/test_dataclasses.py ...... [ 36%] tests/test_factory_hooks.py . [ 36%] tests/test_gen_dict.py .... [ 37%] tests/test_generics.py .................... [ 42%] tests/test_unstructure.py .. [ 43%] tests/strategies/test_tagged_unions.py ............ [ 46%] tests/test_copy.py ... [ 46%] tests/test_disambigutors.py ... [ 47%] tests/test_final.py ........ [ 49%] tests/test_function_dispatch.py .. [ 49%] tests/test_gen.py ... [ 50%] tests/test_gen_dict.py ..........s [ 53%] tests/test_gen_dict_563.py .. [ 53%] tests/test_generics.py .....ss......ss [ 57%] tests/test_multistrategy_dispatch.py ... [ 58%] tests/test_newtypes.py .... [ 59%] tests/test_recursive.py . [ 59%] tests/test_structure.py ................... [ 63%] tests/test_structure_attrs.py ..................... [ 68%] tests/test_typeddicts.py FF.Fs.F... [ 71%] tests/test_unions.py ..ss.. [ 72%] tests/test_unstructure.py ........ [ 74%] tests/test_unstructure_collections.py s.ss [ 75%] tests/test_v.py ...... [ 77%] tests/test_validation.py ......... [ 79%] tests/strategies/test_include_subclasses.py .........................xxx...xxx.x...x.........................xxx...xxx.x.......... [100%] ========================================================================================= FAILURES ========================================================================================== ___________________________________________________________________________________ test_simple_roundtrip ___________________________________________________________________________________ @given(simple_typeddicts(typeddict_cls=None if not is_py38 else ExtensionsTypedDict)) > def test_simple_roundtrip(cls_and_instance) -> None: f = .run_test_as_given..wrapped_test at 0x7f9f40af7ca0> tests/test_typeddicts.py:61: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/test_typeddicts.py:74: in test_simple_roundtrip restructured = c.structure(unstructured, cls) c = cls = cls_and_instance = (, {}) instance = {} unstructured = {} ../../BUILDROOT/python-cattrs-23.1.2-2.fc35.x86_64/usr/lib/python3.8/site-packages/cattrs/converters.py:334: in structure return self._structure_func.dispatch(cl)(obj, cl) cl = obj = {} self = _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ = {}, cl = @staticmethod def _structure_error(_, cl: Type) -> NoReturn: """At the bottom of the condition stack, we explode if we can't handle it.""" msg = "Unsupported type: {0!r}. Register a structure hook for " "it.".format(cl) > raise StructureHandlerNotFoundError(msg, type_=cl) E cattrs.errors.StructureHandlerNotFoundError: Unsupported type: . Register a structure hook for it. E Falsifying example: test_simple_roundtrip( E cls_and_instance=(TypedDict, {}), E ) _ = {} cl = msg = 'Unsupported type: . Register a structure hook for it.' ../../BUILDROOT/python-cattrs-23.1.2-2.fc35.x86_64/usr/lib/python3.8/site-packages/cattrs/converters.py:402: StructureHandlerNotFoundError ___________________________________________________________________________________ test_simple_nontotal ____________________________________________________________________________________ @given( > simple_typeddicts( total=False, typeddict_cls=None if not is_py38 else ExtensionsTypedDict ), booleans(), ) f = .run_test_as_given..wrapped_test at 0x7f9f40af7ee0> tests/test_typeddicts.py:81: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/test_typeddicts.py:99: in test_simple_nontotal restructured = c.structure(unstructured, cls) c = cls = cls_and_instance = (, {}) detailed_validation = False instance = {} unstructured = {} ../../BUILDROOT/python-cattrs-23.1.2-2.fc35.x86_64/usr/lib/python3.8/site-packages/cattrs/converters.py:334: in structure return self._structure_func.dispatch(cl)(obj, cl) cl = obj = {} self = _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ = {}, cl = @staticmethod def _structure_error(_, cl: Type) -> NoReturn: """At the bottom of the condition stack, we explode if we can't handle it.""" msg = "Unsupported type: {0!r}. Register a structure hook for " "it.".format(cl) > raise StructureHandlerNotFoundError(msg, type_=cl) E cattrs.errors.StructureHandlerNotFoundError: Unsupported type: . Register a structure hook for it. E Falsifying example: test_simple_nontotal( E cls_and_instance=(TypedDict, {}), E detailed_validation=False, E ) _ = {} cl = msg = 'Unsupported type: . Register a structure hook for it.' ../../BUILDROOT/python-cattrs-23.1.2-2.fc35.x86_64/usr/lib/python3.8/site-packages/cattrs/converters.py:402: StructureHandlerNotFoundError ______________________________________________________________________________________ test_extra_keys ______________________________________________________________________________________ @given( > simple_typeddicts_with_extra_keys( typeddict_cls=None if not is_py38 else ExtensionsTypedDict ), booleans(), ) f = .run_test_as_given..wrapped_test at 0x7f9f40b184c0> tests/test_typeddicts.py:122: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/test_typeddicts.py:139: in test_extra_keys structured = c.structure(unstructured, cls) c = cls = cls_instance_extra = (, {}, set()) detailed_validation = False extra = set() instance = {} unstructured = {} ../../BUILDROOT/python-cattrs-23.1.2-2.fc35.x86_64/usr/lib/python3.8/site-packages/cattrs/converters.py:334: in structure return self._structure_func.dispatch(cl)(obj, cl) cl = obj = {} self = _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ = {}, cl = @staticmethod def _structure_error(_, cl: Type) -> NoReturn: """At the bottom of the condition stack, we explode if we can't handle it.""" msg = "Unsupported type: {0!r}. Register a structure hook for " "it.".format(cl) > raise StructureHandlerNotFoundError(msg, type_=cl) E cattrs.errors.StructureHandlerNotFoundError: Unsupported type: . Register a structure hook for it. E Falsifying example: test_extra_keys( E cls_instance_extra=(TypedDict, {}, set()), E detailed_validation=False, E ) _ = {} cl = msg = 'Unsupported type: . Register a structure hook for it.' ../../BUILDROOT/python-cattrs-23.1.2-2.fc35.x86_64/usr/lib/python3.8/site-packages/cattrs/converters.py:402: StructureHandlerNotFoundError _______________________________________________________________________________________ test_required _______________________________________________________________________________________ @given( > simple_typeddicts( total=False, not_required=True, typeddict_cls=None if not is_py38 else ExtensionsTypedDict, ), booleans(), ) f = .run_test_as_given..wrapped_test at 0x7f9f40b18d30> tests/test_typeddicts.py:185: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/test_typeddicts.py:200: in test_required restructured = c.structure(unstructured, cls) c = cls = cls_and_instance = (, {}) detailed_validation = False instance = {} unstructured = {} ../../BUILDROOT/python-cattrs-23.1.2-2.fc35.x86_64/usr/lib/python3.8/site-packages/cattrs/converters.py:334: in structure return self._structure_func.dispatch(cl)(obj, cl) cl = obj = {} self = _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ = {}, cl = @staticmethod def _structure_error(_, cl: Type) -> NoReturn: """At the bottom of the condition stack, we explode if we can't handle it.""" msg = "Unsupported type: {0!r}. Register a structure hook for " "it.".format(cl) > raise StructureHandlerNotFoundError(msg, type_=cl) E cattrs.errors.StructureHandlerNotFoundError: Unsupported type: . Register a structure hook for it. E Falsifying example: test_required( E cls_and_instance=(TypedDict, {}), E detailed_validation=False, E ) _ = {} cl = msg = 'Unsupported type: . Register a structure hook for it.' ../../BUILDROOT/python-cattrs-23.1.2-2.fc35.x86_64/usr/lib/python3.8/site-packages/cattrs/converters.py:402: StructureHandlerNotFoundError ----------------------- benchmark 'bench/test_attrs_collections.py::test_structure_attrs_mappings[BaseConverter]': 1 tests ---------------------- Name (time in us) Min Max Mean StdDev Median IQR Outliers OPS (Kops/s) Rounds Iterations ------------------------------------------------------------------------------------------------------------------------------------------------- test_structure_attrs_mappings[BaseConverter] 85.5410 326.9881 89.6450 10.7542 87.9299 1.1639 377;2107 11.1551 11263 1 ------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------- benchmark 'bench/test_attrs_collections.py::test_structure_attrs_mappings[Converter]': 1 tests ---------------------- Name (time in us) Min Max Mean StdDev Median IQR Outliers OPS (Kops/s) Rounds Iterations -------------------------------------------------------------------------------------------------------------------------------------------- test_structure_attrs_mappings[Converter] 55.2118 99.9731 56.8316 2.0133 56.1660 0.4508 2283;3268 17.5958 17205 1 -------------------------------------------------------------------------------------------------------------------------------------------- ---------------------- benchmark 'bench/test_attrs_collections.py::test_unstructure_attrs_lists[UnstructureStrategy.AS_DICT-BaseConverter]': 1 tests ----------------------- Name (time in us) Min Max Mean StdDev Median IQR Outliers OPS (Kops/s) Rounds Iterations ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- test_unstructure_attrs_lists[UnstructureStrategy.AS_DICT-BaseConverter] 70.9270 396.5891 72.6267 3.6367 71.7440 0.8841 1367;2252 13.7690 13419 1 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------- benchmark 'bench/test_attrs_collections.py::test_unstructure_attrs_lists[UnstructureStrategy.AS_DICT-Converter]': 1 tests ---------------------- Name (time in us) Min Max Mean StdDev Median IQR Outliers OPS (Kops/s) Rounds Iterations ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- test_unstructure_attrs_lists[UnstructureStrategy.AS_DICT-Converter] 36.0450 84.9799 36.8148 1.3327 36.4291 0.1639 3392;3605 27.1630 26548 1 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------- benchmark 'bench/test_attrs_collections.py::test_unstructure_attrs_lists[UnstructureStrategy.AS_TUPLE-BaseConverter]': 1 tests ---------------------- Name (time in us) Min Max Mean StdDev Median IQR Outliers OPS (Kops/s) Rounds Iterations ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- test_unstructure_attrs_lists[UnstructureStrategy.AS_TUPLE-BaseConverter] 71.2350 115.4959 73.0996 3.4113 71.9579 0.5502 1565;2501 13.6800 13837 1 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------- benchmark 'bench/test_attrs_collections.py::test_unstructure_attrs_lists[UnstructureStrategy.AS_TUPLE-Converter]': 1 tests ---------------------- Name (time in us) Min Max Mean StdDev Median IQR Outliers OPS (Kops/s) Rounds Iterations ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- test_unstructure_attrs_lists[UnstructureStrategy.AS_TUPLE-Converter] 57.0531 101.9512 58.3124 1.9076 57.7031 0.3029 2465;2594 17.1490 16984 1 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------- benchmark 'bench/test_attrs_collections.py::test_unstructure_attrs_mappings[UnstructureStrategy.AS_DICT-BaseConverter]': 1 tests ---------------------- Name (time in us) Min Max Mean StdDev Median IQR Outliers OPS (Kops/s) Rounds Iterations ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- test_unstructure_attrs_mappings[UnstructureStrategy.AS_DICT-BaseConverter] 73.7291 120.1101 74.9856 2.1817 74.2739 0.2760 1537;2014 13.3359 13392 1 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------- benchmark 'bench/test_attrs_collections.py::test_unstructure_attrs_mappings[UnstructureStrategy.AS_DICT-Converter]': 1 tests ---------------------- Name (time in us) Min Max Mean StdDev Median IQR Outliers OPS (Kops/s) Rounds Iterations -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- test_unstructure_attrs_mappings[UnstructureStrategy.AS_DICT-Converter] 19.4882 87.2549 20.1151 1.7408 19.8388 0.1329 1700;5508 49.7138 46054 1 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------- benchmark 'bench/test_attrs_collections.py::test_unstructure_attrs_mappings[UnstructureStrategy.AS_TUPLE-BaseConverter]': 1 tests ----------------------- Name (time in us) Min Max Mean StdDev Median IQR Outliers OPS (Kops/s) Rounds Iterations -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- test_unstructure_attrs_mappings[UnstructureStrategy.AS_TUPLE-BaseConverter] 76.0572 335.2931 77.5729 4.0150 76.6821 0.3180 1246;2127 12.8911 12094 1 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------- benchmark 'bench/test_attrs_collections.py::test_unstructure_attrs_mappings[UnstructureStrategy.AS_TUPLE-Converter]': 1 tests ---------------------- Name (time in us) Min Max Mean StdDev Median IQR Outliers OPS (Kops/s) Rounds Iterations --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- test_unstructure_attrs_mappings[UnstructureStrategy.AS_TUPLE-Converter] 44.0690 380.6120 45.5458 3.7512 44.6620 2.5760 486;281 21.9559 22374 1 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------- benchmark 'bench/test_attrs_nested.py::test_unstruct_attrs_deep_nest[UnstructureStrategy.AS_DICT-BaseConverter]': 1 tests --------------------- Name (time in ms) Min Max Mean StdDev Median IQR Outliers OPS Rounds Iterations -------------------------------------------------------------------------------------------------------------------------------------------------------------------- test_unstruct_attrs_deep_nest[UnstructureStrategy.AS_DICT-BaseConverter] 2.4489 26.6130 2.5622 1.2078 2.4603 0.0599 1;55 390.2846 400 1 -------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------- benchmark 'bench/test_attrs_nested.py::test_unstruct_attrs_deep_nest[UnstructureStrategy.AS_DICT-Converter]': 1 tests ----------------------------- Name (time in us) Min Max Mean StdDev Median IQR Outliers OPS (Kops/s) Rounds Iterations --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- test_unstruct_attrs_deep_nest[UnstructureStrategy.AS_DICT-Converter] 504.4669 20,479.9050 552.8538 622.1222 528.2140 23.9605 2;104 1.8088 1832 1 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------- benchmark 'bench/test_attrs_nested.py::test_unstruct_attrs_deep_nest[UnstructureStrategy.AS_TUPLE-BaseConverter]': 1 tests -------------------- Name (time in ms) Min Max Mean StdDev Median IQR Outliers OPS Rounds Iterations -------------------------------------------------------------------------------------------------------------------------------------------------------------------- test_unstruct_attrs_deep_nest[UnstructureStrategy.AS_TUPLE-BaseConverter] 2.5697 2.8308 2.6047 0.0554 2.5807 0.0172 53;71 383.9158 390 1 -------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------- benchmark 'bench/test_attrs_nested.py::test_unstruct_attrs_deep_nest[UnstructureStrategy.AS_TUPLE-Converter]': 1 tests -------------------- Name (time in ms) Min Max Mean StdDev Median IQR Outliers OPS Rounds Iterations ---------------------------------------------------------------------------------------------------------------------------------------------------------------- test_unstruct_attrs_deep_nest[UnstructureStrategy.AS_TUPLE-Converter] 2.5303 2.8036 2.5562 0.0496 2.5383 0.0064 46;69 391.2097 393 1 ---------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------ benchmark 'bench/test_attrs_nested.py::test_unstructure_attrs_nested[UnstructureStrategy.AS_DICT-BaseConverter]': 1 tests ------------------------- Name (time in us) Min Max Mean StdDev Median IQR Outliers OPS (Kops/s) Rounds Iterations ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- test_unstructure_attrs_nested[UnstructureStrategy.AS_DICT-BaseConverter] 11.3901 35.0771 11.7496 0.5719 11.6371 0.1071 8190;8564 85.1093 84654 1 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------- benchmark 'bench/test_attrs_nested.py::test_unstructure_attrs_nested[UnstructureStrategy.AS_DICT-Converter]': 1 tests ------------------------ Name (time in us) Min Max Mean StdDev Median IQR Outliers OPS (Kops/s) Rounds Iterations ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- test_unstructure_attrs_nested[UnstructureStrategy.AS_DICT-Converter] 2.5150 27.1240 2.6414 0.2659 2.6065 0.0414 2255;19659 378.5800 178823 2 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------- benchmark 'bench/test_attrs_nested.py::test_unstructure_attrs_nested[UnstructureStrategy.AS_TUPLE-BaseConverter]': 1 tests ------------------------- Name (time in us) Min Max Mean StdDev Median IQR Outliers OPS (Kops/s) Rounds Iterations ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ test_unstructure_attrs_nested[UnstructureStrategy.AS_TUPLE-BaseConverter] 12.0031 66.4960 12.4433 0.8833 12.2602 0.1050 2183;11475 80.3643 82157 1 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------- benchmark 'bench/test_attrs_nested.py::test_unstructure_attrs_nested[UnstructureStrategy.AS_TUPLE-Converter]': 1 tests ------------------------ Name (time in us) Min Max Mean StdDev Median IQR Outliers OPS (Kops/s) Rounds Iterations ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- test_unstructure_attrs_nested[UnstructureStrategy.AS_TUPLE-Converter] 11.9959 72.0909 12.3615 0.8306 12.2092 0.0899 2103;9286 80.8965 82083 1 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------- benchmark 'bench/test_attrs_primitives.py::test_structure_attrs_primitives[UnstructureStrategy.AS_DICT-BaseConverter]': 1 tests ----------------------- Name (time in us) Min Max Mean StdDev Median IQR Outliers OPS (Kops/s) Rounds Iterations ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ test_structure_attrs_primitives[UnstructureStrategy.AS_DICT-BaseConverter] 30.1038 67.3321 30.9001 1.1725 30.5311 0.1898 4656;4687 32.3624 32656 1 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ----------------------- benchmark 'bench/test_attrs_primitives.py::test_structure_attrs_primitives[UnstructureStrategy.AS_DICT-Converter]': 1 tests ----------------------- Name (time in us) Min Max Mean StdDev Median IQR Outliers OPS (Kops/s) Rounds Iterations --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- test_structure_attrs_primitives[UnstructureStrategy.AS_DICT-Converter] 13.1340 39.3658 13.7212 0.6811 13.5921 0.1309 8794;14066 72.8801 75048 1 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------- benchmark 'bench/test_attrs_primitives.py::test_structure_attrs_primitives[UnstructureStrategy.AS_TUPLE-BaseConverter]': 1 tests ---------------------- Name (time in us) Min Max Mean StdDev Median IQR Outliers OPS (Kops/s) Rounds Iterations ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- test_structure_attrs_primitives[UnstructureStrategy.AS_TUPLE-BaseConverter] 25.5660 65.2710 26.5534 1.6369 26.1120 0.3108 2151;5778 37.6600 35545 1 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------- benchmark 'bench/test_attrs_primitives.py::test_structure_attrs_primitives[UnstructureStrategy.AS_TUPLE-Converter]': 1 tests ---------------------- Name (time in us) Min Max Mean StdDev Median IQR Outliers OPS (Kops/s) Rounds Iterations --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- test_structure_attrs_primitives[UnstructureStrategy.AS_TUPLE-Converter] 25.9089 70.4732 26.9053 1.6392 26.4859 0.2668 2225;5774 37.1674 37891 1 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------- benchmark 'bench/test_attrs_primitives.py::test_unstructure_attrs_primitives[UnstructureStrategy.AS_DICT-BaseConverter]': 1 tests ----------------------- Name (time in us) Min Max Mean StdDev Median IQR Outliers OPS (Kops/s) Rounds Iterations -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- test_unstructure_attrs_primitives[UnstructureStrategy.AS_DICT-BaseConverter] 14.9591 85.2090 15.6604 1.4525 15.3370 0.1690 2369;7932 63.8554 60402 1 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------- benchmark 'bench/test_attrs_primitives.py::test_unstructure_attrs_primitives[UnstructureStrategy.AS_DICT-Converter]': 1 tests ---------------------- Name (time in us) Min Max Mean StdDev Median IQR Outliers OPS (Kops/s) Rounds Iterations -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- test_unstructure_attrs_primitives[UnstructureStrategy.AS_DICT-Converter] 4.9579 48.9689 5.2014 0.4633 5.1202 0.0780 2429;35136 192.2549 199044 1 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------- benchmark 'bench/test_attrs_primitives.py::test_unstructure_attrs_primitives[UnstructureStrategy.AS_TUPLE-BaseConverter]': 1 tests ---------------------- Name (time in us) Min Max Mean StdDev Median IQR Outliers OPS (Kops/s) Rounds Iterations --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- test_unstructure_attrs_primitives[UnstructureStrategy.AS_TUPLE-BaseConverter] 14.6232 52.5939 15.1488 0.7000 14.9901 0.1590 7383;7618 66.0120 62630 1 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------- benchmark 'bench/test_attrs_primitives.py::test_unstructure_attrs_primitives[UnstructureStrategy.AS_TUPLE-Converter]': 1 tests ---------------------- Name (time in us) Min Max Mean StdDev Median IQR Outliers OPS (Kops/s) Rounds Iterations ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- test_unstructure_attrs_primitives[UnstructureStrategy.AS_TUPLE-Converter] 14.6681 49.2670 15.1867 0.7607 14.9850 0.1441 8409;9584 65.8472 62650 1 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------ benchmark 'bench/test_primitives.py::test_unstructure_float[BaseConverter]': 1 tests ----------------------------- Name (time in ns) Min Max Mean StdDev Median IQR Outliers OPS (Mops/s) Rounds Iterations ------------------------------------------------------------------------------------------------------------------------------------------------- test_unstructure_float[BaseConverter] 390.2436 2,494.3341 405.0274 30.2288 400.2553 4.5014 1761;23582 2.4690 193232 12 ------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------ benchmark 'bench/test_primitives.py::test_unstructure_float[Converter]': 1 tests ----------------------------- Name (time in ns) Min Max Mean StdDev Median IQR Outliers OPS (Mops/s) Rounds Iterations --------------------------------------------------------------------------------------------------------------------------------------------- test_unstructure_float[Converter] 390.8256 3,388.4232 407.9953 33.2498 403.2433 6.0730 1255;24352 2.4510 191869 12 --------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------ benchmark 'bench/test_primitives.py::test_unstructure_int[BaseConverter]': 1 tests ----------------------------- Name (time in ns) Min Max Mean StdDev Median IQR Outliers OPS (Mops/s) Rounds Iterations ----------------------------------------------------------------------------------------------------------------------------------------------- test_unstructure_int[BaseConverter] 386.0869 2,515.8605 400.3997 28.5614 396.0091 4.3880 2442;22463 2.4975 195582 13 ----------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------ benchmark 'bench/test_primitives.py::test_unstructure_int[Converter]': 1 tests ----------------------------- Name (time in ns) Min Max Mean StdDev Median IQR Outliers OPS (Mops/s) Rounds Iterations ------------------------------------------------------------------------------------------------------------------------------------------- test_unstructure_int[Converter] 391.6928 3,022.0701 407.8166 30.0984 403.1552 4.6208 2253;23220 2.4521 193128 13 ------------------------------------------------------------------------------------------------------------------------------------------- Legend: Outliers: 1 Standard Deviation from Mean; 1.5 IQR (InterQuartile Range) from 1st Quartile and 3rd Quartile. OPS: Operations Per Second, computed as 1 / Mean ================================================================================== short test summary info ================================================================================== SKIPPED [1] tests/test_baseconverter.py:113: 3.10+ union syntax SKIPPED [1] tests/test_baseconverter.py:177: 3.10+ union syntax SKIPPED [1] tests/test_converter.py:273: 3.10+ union syntax SKIPPED [1] tests/test_converter.py:339: 3.10+ union syntax SKIPPED [1] tests/test_converter.py:623: 3.9+ only SKIPPED [1] tests/test_gen_dict.py:292: literals and annotated are 3.9+ SKIPPED [2] tests/test_generics.py:74: 3.9+ generics syntax SKIPPED [1] tests/test_generics.py:262: 3.10+ union syntax SKIPPED [1] tests/test_generics.py:283: 3.11+ only SKIPPED [1] tests/test_typeddicts.py:147: 3.11+ only SKIPPED [2] tests/test_unions.py:42: 3.10 union syntax SKIPPED [1] tests/test_unstructure_collections.py:21: Requires Python 3.9+ SKIPPED [1] tests/test_unstructure_collections.py:104: Requires Python 3.9+ SKIPPED [1] tests/test_unstructure_collections.py:160: Requires Python 3.9+ XFAIL tests/strategies/test_include_subclasses.py::test_structuring_with_inheritance[wo-subclasses-child1-only] - reason: Cannot structure subclasses if include_subclasses strategy is not used XFAIL tests/strategies/test_include_subclasses.py::test_structuring_with_inheritance[wo-subclasses-child2-only] - reason: Cannot structure subclasses if include_subclasses strategy is not used XFAIL tests/strategies/test_include_subclasses.py::test_structuring_with_inheritance[wo-subclasses-grandchild-only] - reason: Cannot structure subclasses if include_subclasses strategy is not used XFAIL tests/strategies/test_include_subclasses.py::test_structuring_with_inheritance[wo-subclasses-non-union-compose-parent] - reason: Cannot structure subclasses if include_subclasses strategy is not used XFAIL tests/strategies/test_include_subclasses.py::test_structuring_with_inheritance[wo-subclasses-non-union-compose-child] - reason: Cannot structure subclasses if include_subclasses strategy is not used XFAIL tests/strategies/test_include_subclasses.py::test_structuring_with_inheritance[wo-subclasses-non-union-compose-grandchild] - reason: Cannot structure subclasses if include_subclasses strategy is not used XFAIL tests/strategies/test_include_subclasses.py::test_structuring_with_inheritance[wo-subclasses-non-union-container] - reason: Cannot structure subclasses if include_subclasses strategy is not used XFAIL tests/strategies/test_include_subclasses.py::test_circular_reference[wo-subclasses] - reason: Cannot succeed if include_subclasses strategy is not used XFAIL tests/strategies/test_include_subclasses.py::test_unstructuring_with_inheritance[wo-subclasses-child1-only] - reason: Cannot succeed if include_subclasses strategy is not used XFAIL tests/strategies/test_include_subclasses.py::test_unstructuring_with_inheritance[wo-subclasses-child2-only] - reason: Cannot succeed if include_subclasses strategy is not used XFAIL tests/strategies/test_include_subclasses.py::test_unstructuring_with_inheritance[wo-subclasses-grandchild-only] - reason: Cannot succeed if include_subclasses strategy is not used XFAIL tests/strategies/test_include_subclasses.py::test_unstructuring_with_inheritance[wo-subclasses-non-union-compose-parent] - reason: Cannot succeed if include_subclasses strategy is not used XFAIL tests/strategies/test_include_subclasses.py::test_unstructuring_with_inheritance[wo-subclasses-non-union-compose-child] - reason: Cannot succeed if include_subclasses strategy is not used XFAIL tests/strategies/test_include_subclasses.py::test_unstructuring_with_inheritance[wo-subclasses-non-union-compose-grandchild] - reason: Cannot succeed if include_subclasses strategy is not used XFAIL tests/strategies/test_include_subclasses.py::test_unstructuring_with_inheritance[wo-subclasses-non-union-container] - reason: Cannot succeed if include_subclasses strategy is not used FAILED tests/test_typeddicts.py::test_simple_roundtrip - cattrs.errors.StructureHandlerNotFoundError: Unsupported type: . Register a structure hook for it. FAILED tests/test_typeddicts.py::test_simple_nontotal - cattrs.errors.StructureHandlerNotFoundError: Unsupported type: . Register a structure hook for it. FAILED tests/test_typeddicts.py::test_extra_keys - cattrs.errors.StructureHandlerNotFoundError: Unsupported type: . Register a structure hook for it. FAILED tests/test_typeddicts.py::test_required - cattrs.errors.StructureHandlerNotFoundError: Unsupported type: . Register a structure hook for it. ============================================================= 4 failed, 380 passed, 16 skipped, 15 xfailed in 415.54s (0:06:55) ============================================================= ```
Tinche commented 10 months ago

You're using the 23.1.2 git tag? (https://github.com/python-attrs/cattrs/releases/tag/v23.1.2)

That version was still using poetry, and I see typing_extensions is locked to 4.5.0 in the lockfile. I wonder if that's the issue. Can you try rerunning the tests with that version of typing_extensions? In the meantime, I can run the test suite locally on 3.8.18 specifically.

kloczek commented 10 months ago

You're using the 23.1.2 git tag? (https://github.com/python-attrs/cattrs/releases/tag/v23.1.2)

Yes I'm using as input source autogenerated from git tar ball.

You're using the 23.1.2 git tag? (https://github.com/python-attrs/cattrs/releases/tag/v23.1.2)

That version was still using poetry, and I see typing_extensions is locked to 4.5.0 in the lockfile. I wonder if that's the issue. Can you try rerunning the tests with that version of typing_extensions? In the meantime, I can run the test suite locally on 3.8.18 specifically.

Indeed I'm using typing_extensions 4.8.0 however nothing warned abut that it is to high version 😋

kloczek commented 10 months ago

Nevertheless if use to high typing_extensions affects only test suite severity of this issue goes down automatically. Question is only: is it like this or not? 😋

Tinche commented 10 months ago

I can confirm the typeddict tests fail on 3.8.18, typing_extensions 4.8 in v23.1.2. However they work on main using that combination, so there's nothing to do here.

You can ignore those tests but be aware typed dicts from typing_extensions won't work properly. Remedies would be using an older version of typing_extensions, using cattrs from main (right now is pretty stable), or waiting for 23.2.0 which is pretty close.

I'm going to close this now, feel free to reopen with new data!