question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Test failures with Python 3.11

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
pllimcommented, 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

0reactions
pllimcommented, Sep 16, 2022

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Test failures with Python 3.11.0b4 · Issue #10131 · pytest-dev ...
We have updated Python from 3.11.0b3 to 3.11.0b4 in Fedora Linux 37 and we see some test failures of pytest 7.1.2.
Read more >
Unit test failure with Python 3.11 in test_shell.py
As it seems a test case issue, I'm blacklisting these 2 buggy tests in my package . ... Unit test failure with Python...
Read more >
unittest — Unit testing framework — Python 3.11.1 ...
Skipping tests and expected failures​​ New in version 3.1. Unittest supports skipping individual test methods and even whole classes of tests. In addition,...
Read more >
What's New In Python 3.11 — Python 3.11.1 documentation
This article explains the new features in Python 3.11, compared to 3.10. ... These enhanced errors can also be helpful when dealing with...
Read more >
Porting Python 2 Code to Python 3 — Python 3.11.1 ...
Make sure you have good test coverage (coverage.py can help; python -m pip install ... code knowing that any tests which fail is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found