Bug 2291646

Summary: python-cattrs FTBFS with Python 3.13 (and fails to install): AssertionError: assert HypDataclass(a=nan) == HypDataclass(a=nan), assert Counter({1: 2}) == immutables.Map({1: 2})
Product: [Fedora] Fedora Reporter: Fedora Fails To Install <fti-bugs>
Component: python-cattrsAssignee: Ankur Sinha (FranciscoD) <sanjay.ankur>
Status: CLOSED WORKSFORME QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: fedora, gui1ty, hobbes1069, mhroncok, neuro-sig, sanjay.ankur
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-06-17 23:14:26 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2260875, 2260877, 2244836, 2291548, 2291689, 2291859, 2291881, 2291900, 2291910, 2292002, 2292005    

Description Fedora Fails To Install 2024-06-12 11:21:38 UTC
Hello,

Please note that this comment was generated automatically by https://pagure.io/releng/blob/main/f/scripts/ftbfs-fti/follow-policy.py
If you feel that this output has mistakes, please open an issue at https://pagure.io/releng/

Your package (python-cattrs) Fails To Install in Fedora 41:

can't install python3-cattrs+msgpack:
  - nothing provides python(abi) = 3.12 needed by python3-cattrs+msgpack-23.2.3-5.fc41.noarch
  - nothing provides python3.12dist(msgpack) >= 1.0.5 needed by python3-cattrs+msgpack-23.2.3-5.fc41.noarch
  
can't install python3-cattrs+orjson:
  - nothing provides python(abi) = 3.12 needed by python3-cattrs+orjson-23.2.3-5.fc41.noarch
  - nothing provides python3.12dist(orjson) >= 3.9.2 needed by python3-cattrs+orjson-23.2.3-5.fc41.noarch
  
can't install python3-cattrs+pyyaml:
  - nothing provides python(abi) = 3.12 needed by python3-cattrs+pyyaml-23.2.3-5.fc41.noarch
  - nothing provides python3.12dist(pyyaml) >= 6 needed by python3-cattrs+pyyaml-23.2.3-5.fc41.noarch
  
can't install python3-cattrs+tomlkit:
  - nothing provides python(abi) = 3.12 needed by python3-cattrs+tomlkit-23.2.3-5.fc41.noarch
  - nothing provides python3.12dist(tomlkit) >= 0.11.8 needed by python3-cattrs+tomlkit-23.2.3-5.fc41.noarch
  
can't install python3-cattrs+ujson:
  - nothing provides python(abi) = 3.12 needed by python3-cattrs+ujson-23.2.3-5.fc41.noarch
  - nothing provides python3.12dist(ujson) >= 5.7 needed by python3-cattrs+ujson-23.2.3-5.fc41.noarch
  
can't install python3-cattrs:
  - nothing provides python(abi) = 3.12 needed by python3-cattrs-23.2.3-5.fc41.noarch
  - nothing provides python3.12dist(attrs) >= 23.1 needed by python3-cattrs-23.2.3-5.fc41.noarch
  
If you know about this problem and are planning on fixing it, please acknowledge so by setting the bug status to ASSIGNED. If you don't have time to maintain this package, consider orphaning it, so maintainers of dependent packages realize the problem.


If you don't react accordingly to the policy for FTBFS/FTI bugs (https://docs.fedoraproject.org/en-US/fesco/Fails_to_build_from_source_Fails_to_install/), your package may be orphaned in 8+ weeks.


P.S. The data was generated solely from koji buildroot, so it might be newer than the latest compose or the content on mirrors. To reproduce, use the koji/local repo only, e.g. in mock:

    $ mock -r fedora-41-x86_64 --config-opts mirrored=False install python3-cattrs+msgpack python3-cattrs+orjson python3-cattrs+pyyaml python3-cattrs+tomlkit python3-cattrs+ujson python3-cattrs


P.P.S. If this bug has been reported in the middle of upgrading multiple dependent packages, please consider using side tags: https://docs.fedoraproject.org/en-US/fesco/Updates_Policy/#updating-inter-dependent-packages

Thanks!

Comment 1 Sandro 2024-06-12 14:37:48 UTC
This is FTBFS rather than FTI:

=================================== FAILURES ===================================
_________________ test_collection_unstructure_override_mapping _________________
[gw7] linux -- Python 3.13.0 /usr/bin/python3

    @pytest.mark.skipif(not is_py39_plus, reason="Requires Python 3.9+")
    def test_collection_unstructure_override_mapping():
        """Test overriding unstructuring mappings."""
    
        # Using Counter
        c = Converter(unstruct_collection_overrides={Counter: Map})
        assert c.unstructure(Counter({1: 2})) == Map({1: 2})
>       assert c.unstructure(Counter({1: 2}), unstructure_as=Counter[int]) == Map({1: 2})
E       assert Counter({1: 2}) == immutables.Map({1: 2})
E         Use -v to get more diff

c          = <cattrs.converters.Converter object at 0x7f2a06ebd120>

tests/test_unstructure_collections.py:168: AssertionError
____________________ test_unmodified_generated_structuring _____________________
[gw4] linux -- Python 3.13.0 /usr/bin/python3

    @given(
>       cl_and_vals=nested_typed_classes()
        | simple_typed_classes()
        | simple_typed_dataclasses(),
        dv=...,
    )

f          = <function given.<locals>.run_test_as_given.<locals>.wrapped_test at 0x7ffa09898540>

tests/test_gen_dict.py:166: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cl_and_vals = (<class 'tests.typed.HypDataclass'>, (nan,), {}), dv = False

    @given(
        cl_and_vals=nested_typed_classes()
        | simple_typed_classes()
        | simple_typed_dataclasses(),
        dv=...,
    )
    def test_unmodified_generated_structuring(cl_and_vals, dv: bool):
        converter = Converter(detailed_validation=dv)
        cl, vals, kwargs = cl_and_vals
        fn = make_dict_structure_fn(cl, converter, _cattrs_detailed_validation=dv)
    
        inst = cl(*vals, **kwargs)
    
        unstructured = converter.unstructure(inst)
    
        assert "Hyp" not in repr(unstructured)
    
        converter.register_structure_hook(cl, fn)
    
        res = converter.structure(unstructured, cl)
    
>       assert inst == res
E       AssertionError: assert HypDataclass(a=nan) == HypDataclass(a=nan)
E         
E         Differing attributes:
E         ['a']
E         
E         Drill down into differing attribute a:
E           a: nan != nan
E       Falsifying example: test_unmodified_generated_structuring(
E           cl_and_vals=(tests.typed.HypDataclass, (nan,), {}),  # Saw 1 signaling NaN
E           dv=False,  # or any other generated value
E       )
E       Explanation:
E           These lines were always and only run by failing examples:
E               /usr/lib/python3.13/site-packages/_pytest/assertion/util.py:456

cl         = <class 'tests.typed.HypDataclass'>
cl_and_vals = (<class 'tests.typed.HypDataclass'>, (nan,), {})
converter  = <cattrs.converters.Converter object at 0x7ffa0943e700>
dv         = False
fn         = <function structure_HypDataclass at 0x7ff9f7ef6840>
inst       = HypDataclass(a=nan)
kwargs     = {}
res        = HypDataclass(a=nan)
unstructured = {'a': nan}
vals       = (nan,)

tests/test_gen_dict.py:186: AssertionError

Comment 2 Miro Hrončok 2024-06-12 16:29:17 UTC
*** Bug 2292049 has been marked as a duplicate of this bug. ***

Comment 3 Miro Hrončok 2024-06-17 18:43:18 UTC
I suggest we skip the failing tests, with a link to upstream.

Comment 4 Miro Hrončok 2024-06-17 19:00:06 UTC
(In reply to Miro Hrončok from comment #3)
> I suggest we skip the failing tests, with a link to upstream.

https://src.fedoraproject.org/rpms/python-cattrs/pull-request/7

Comment 5 Fedora Fails To Install 2024-06-17 23:14:26 UTC
Hello,

Please note that this comment was generated automatically by https://pagure.io/releng/blob/main/f/scripts/ftbfs-fti/follow-policy.py
If you feel that this output has mistakes, please open an issue at https://pagure.io/releng/

All subpackages of a package against which this bug was filled are now installable or removed from Fedora 41.

Thanks for taking care of it!