Bug 1900683

Summary: python-cloudpickle fails to build with Python 3.10: tests fail with AssertionError
Product: [Fedora] Fedora Reporter: Tomáš Hrnčiar <thrnciar>
Component: python-cloudpickleAssignee: Lumír Balhar <lbalhar>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: lbalhar, mhroncok, thrnciar
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: 2020-11-26 07:43:56 UTC Type: Bug
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: 1890881    

Description Tomáš Hrnčiar 2020-11-23 14:19:10 UTC
python-cloudpickle fails to build with Python 3.10.0a2.

=================================== FAILURES ===================================
__________ CloudPickleTest.test_locally_defined_class_with_type_hints __________

self = <tests.cloudpickle_test.CloudPickleTest testMethod=test_locally_defined_class_with_type_hints>

    def test_locally_defined_class_with_type_hints(self):
        with subprocess_worker(protocol=self.protocol) as worker:
            for type_ in _all_types_to_test():
                class MyClass:
                    def method(self, arg: type_) -> type_:
                        return arg
                MyClass.__annotations__ = {'attribute': type_}
    
                def check_annotations(obj, expected_type):
                    assert obj.__annotations__["attribute"] == expected_type
                    assert obj.method.__annotations__["arg"] == expected_type
                    assert (
                        obj.method.__annotations__["return"] == expected_type
                    )
                    return "ok"
    
                obj = MyClass()
>               assert check_annotations(obj, type_) == "ok"

tests/cloudpickle_test.py:2217: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

obj = <tests.cloudpickle_test.CloudPickleTest.test_locally_defined_class_with_type_hints.<locals>.MyClass object at 0x7f804db0ef10>
expected_type = <class 'tests.cloudpickle_test._all_types_to_test.<locals>.C'>

    def check_annotations(obj, expected_type):
        assert obj.__annotations__["attribute"] == expected_type
>       assert obj.method.__annotations__["arg"] == expected_type
E       AssertionError: assert 'type_' == <class 'tests...t.<locals>.C'>
E         +'type_'
E         -<class 'tests.cloudpickle_test._all_types_to_test.<locals>.C'>

tests/cloudpickle_test.py:2210: AssertionError
_____ Protocol2CloudPickleTest.test_locally_defined_class_with_type_hints ______

self = <tests.cloudpickle_test.Protocol2CloudPickleTest testMethod=test_locally_defined_class_with_type_hints>

    def test_locally_defined_class_with_type_hints(self):
        with subprocess_worker(protocol=self.protocol) as worker:
            for type_ in _all_types_to_test():
                class MyClass:
                    def method(self, arg: type_) -> type_:
                        return arg
                MyClass.__annotations__ = {'attribute': type_}
    
                def check_annotations(obj, expected_type):
                    assert obj.__annotations__["attribute"] == expected_type
                    assert obj.method.__annotations__["arg"] == expected_type
                    assert (
                        obj.method.__annotations__["return"] == expected_type
                    )
                    return "ok"
    
                obj = MyClass()
>               assert check_annotations(obj, type_) == "ok"

tests/cloudpickle_test.py:2217: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

obj = <tests.cloudpickle_test.CloudPickleTest.test_locally_defined_class_with_type_hints.<locals>.MyClass object at 0x7f804e541e20>
expected_type = <class 'tests.cloudpickle_test._all_types_to_test.<locals>.C'>

    def check_annotations(obj, expected_type):
        assert obj.__annotations__["attribute"] == expected_type
>       assert obj.method.__annotations__["arg"] == expected_type
E       AssertionError: assert 'type_' == <class 'tests...t.<locals>.C'>
E         +'type_'
E         -<class 'tests.cloudpickle_test._all_types_to_test.<locals>.C'>

tests/cloudpickle_test.py:2210: AssertionError
=========================== short test summary info ============================
FAILED tests/cloudpickle_test.py::CloudPickleTest::test_locally_defined_class_with_type_hints
FAILED tests/cloudpickle_test.py::Protocol2CloudPickleTest::test_locally_defined_class_with_type_hints
=========== 2 failed, 213 passed, 13 skipped, 3 deselected in 9.81s ============
error: Bad exit status from /var/tmp/rpm-tmp.Umvt7w (%check)
    Bad exit status from /var/tmp/rpm-tmp.Umvt7w (%check)

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.10/fedora-rawhide-x86_64/01773072-python-cloudpickle/

For all our attempts to build python-cloudpickle with Python 3.10, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/package/python-cloudpickle/

Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.10:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/

Let us know here if you have any questions.

Python 3.10 will be included in Fedora 35. To make that update smoother, we're building Fedora packages with early pre-releases of Python 3.10.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon.
We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.