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

Test failures with Python 3.11 #13522

Closed
sergiopasra opened this issue Aug 3, 2022 · 7 comments · Fixed by #13614
Closed

Test failures with Python 3.11 #13522

sergiopasra opened this issue Aug 3, 2022 · 7 comments · Fixed by #13614

Comments

@sergiopasra
Copy link
Contributor

sergiopasra commented Aug 3, 2022

Description

I'm building astropy 5.1 with a prerelease of python 3.11 for the next Fedora release. I'm getting this error in the tests:

=================================== FAILURES ===================================
_______ test_simple_object[0-StaticMatrixTransform-args6-kwargs6-False] ________
pickle_protocol = 0
name = <class 'astropy.coordinates.transformations.StaticMatrixTransform'>
args = [array([[1., 0., 0.],
       [0., 1., 0.],
       [0., 0., 1.]]), <class 'astropy.coordinates.builtin_frames.icrs.ICRS'>, <class 'astropy.coordinates.builtin_frames.icrs.ICRS'>]
kwargs = {}, xfail = False
    @pytest.mark.parametrize(("name", "args", "kwargs", "xfail"),
                             zip(_names, _args, _kwargs, _xfail))
    def test_simple_object(pickle_protocol, name, args, kwargs, xfail):
        # Tests easily instantiated objects
        if xfail:
            pytest.xfail()
        original = name(*args, **kwargs)
>       check_pickling_recovery(original, pickle_protocol)
astropy/coordinates/tests/test_pickle.py:71: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
astropy/tests/helper.py:446: in check_pickling_recovery
    generic_recursive_equality_test(original, unpickled,
astropy/tests/helper.py:433: in generic_recursive_equality_test
    generic_recursive_equality_test(dict_a[key],
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
a = <class 'astropy.coordinates.builtin_frames.icrs.ICRS'>
b = <class 'astropy.coordinates.builtin_frames.icrs.ICRS'>
class_history = [<class 'abc.ABCMeta'>, <class 'astropy.coordinates.transformations.StaticMatrixTransform'>]
    def generic_recursive_equality_test(a, b, class_history):
        """
        Check if the attributes of a and b are equal. Then,
        check if the attributes of the attributes are equal.
        """
>       dict_a = a.__getstate__() if hasattr(a, '__getstate__') else a.__dict__
E       TypeError: unbound method object.__getstate__() needs an argument
astropy/tests/helper.py:415: TypeError

This is probably related with a change in how objects are pickled. Now object has a default implementation of `getstate

https://docs.python.org/3.11/library/pickle.html#object.__getstate__

Full details in the Fedora bug report: https://bugzilla.redhat.com/show_bug.cgi?id=2101963

@pllim
Copy link
Member

pllim commented Aug 3, 2022

Hello! Do you mean astropy 5.1? There is no 5.10 release. Also, did you try with the dev version? I vaguely remember some fix to the pickling in dev not too long ago.

We have no yet tested astropy against Python 3.11. @astropy/devops-maintainers , should we do it now?

@sergiopasra
Copy link
Contributor Author

Hello! Do you mean astropy 5.1? There is no 5.10 release. Also, did you try with the dev version? I vaguely remember some fix to the pickling in dev not too long ago.

Yes, 5.1

I have tried the tests in b6352e1 and it has the same errors in:

coordinates/tests/test_pickle.py::test_simple_object[0-StaticMatrixTransform-args6-kwargs6-False]
coordinates/tests/test_pickle.py::test_simple_object[1-StaticMatrixTransform-args6-kwargs6-False]
coordinates/tests/test_pickle.py::test_simple_object[-1-StaticMatrixTransform-args6-kwargs6-False]

@sergiopasra
Copy link
Contributor Author

The following tests fail also with python 3.11 (both with devel and 5.1)

astropy/coordinates/tests/test_pickle.py::test_simple_object
astropy/cosmology/flrw/tests/test_base.py::TestFLRW::test_name
astropy/cosmology/flrw/tests/test_lambdacdm.py::TestLambdaCDM::test_name
astropy/cosmology/flrw/tests/test_lambdacdm.py::TestFlatLambdaCDM::test_name
astropy/cosmology/flrw/tests/test_w0cdm.py::TestwCDM::test_name
astropy/cosmology/flrw/tests/test_w0cdm.py::TestFlatwCDM::test_name
astropy/cosmology/flrw/tests/test_w0wacdm.py::Testw0waCDM::test_name
astropy/cosmology/flrw/tests/test_w0wacdm.py::TestFlatw0waCDM::test_name
astropy/cosmology/flrw/tests/test_w0wzcdm.py::Testw0wzCDM::test_name
astropy/cosmology/flrw/tests/test_wpwazpcdm.py::TestwpwaCDM::test_name
astropy/cosmology/tests/test_core.py::TestCosmology::test_name
astropy/table/tests/test_pprint.py::TestColumnsShowHide::test_remove[pprint_exclude_names]
astropy/table/tests/test_pprint.py::TestColumnsShowHide::test_remove[pprint_include_names]
astropy/time/tests/test_mask.py::test_mask_not_writeable

@sergiopasra sergiopasra changed the title Test faillure with Python 3.11: default __getstate__ implementation Test faillures with Python 3.11 Aug 25, 2022
@pllim
Copy link
Member

pllim commented Aug 25, 2022

Hmm lots of cosmology in there... @nstarman ?

Though ultimately, this is hard to fix until we update CI to test against Python 3.11. Maybe soon... I just noticed RC1 is out. https://docs.python.org/3.11/whatsnew/3.11.html

@nstarman
Copy link
Member

nstarman commented Aug 25, 2022

I'll be happy to squash these bugs, just as soon as there's a conda python 3.11 version available, (even a release candidate) :)

@pllim
Copy link
Member

pllim commented Sep 9, 2022

See the failure log in #13614 . Thanks!

@nstarman nstarman changed the title Test faillures with Python 3.11 Test failures with Python 3.11 Sep 9, 2022
@pllim
Copy link
Member

pllim commented Sep 16, 2022

@sergiopasra , please try again with latest dev astropy. Should be fixed now. Thanks for your patience!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants