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

Run GA unittest workflow against python 3.13 too #653

Open
soxofaan opened this issue Oct 31, 2024 · 3 comments
Open

Run GA unittest workflow against python 3.13 too #653

soxofaan opened this issue Oct 31, 2024 · 3 comments

Comments

@soxofaan
Copy link
Member

soxofaan commented Oct 31, 2024

related to dropping support for python 3.7 (#578): start running unit tests against py 3.13 too in github actions

python 3.13 was released 2024-10-07

@soxofaan
Copy link
Member Author

Failing tests with python 3.13:

tests/extra/spectral_indices/test_spectral_indices.py FFFFFFFFFFFFFFFFFF [  3%]
FFFFFFFFFFFFFFFFF                                                        [  3%]

fails on this part:

>           with importlib_resources.files("openeo.extra.spectral_indices") / path as resource_path:
E           TypeError: 'PosixPath' object does not support the context manager protocol

@soxofaan
Copy link
Member Author

One remaining failure:

tests/internal/test_warnings.py ...F...                                  [ 12%]


=================================== FAILURES ===================================
________________________ test_legacy_alias_classmethod _________________________

recwarn = WarningsRecorder(record=True)

    def test_legacy_alias_classmethod(recwarn):
        class Foo:
            @classmethod
            def add(cls, x, y):
                """Add x and y."""
                assert cls is Foo
                return x + y
    
            do_plus = legacy_alias(add, "do_plus", since="v1.2")
    
        assert Foo.add.__doc__ == "Add x and y."
        assert Foo.do_plus.__doc__ == (
            "\n"
            ".. deprecated:: v1.2\n"
            "   Usage of this legacy class method is deprecated. Use\n"
            "   :py:meth:`.add` instead.\n"
        )
    
        assert Foo().add(2, 3) == 5
        assert len(recwarn) == 0
    
        expected_warning = re.escape(
            # Workaround for bug in classmethod detection before Python 3.9 (see https://wrapt.readthedocs.io/en/latest/decorators.html#decorating-class-methods
            f"Call to deprecated {'class method' if sys.version_info >= (3, 9) else 'function (or staticmethod)'} do_plus."
            " (Usage of this legacy class method is deprecated. Use `.add` instead.)"
            " -- Deprecated since version v1.2."
        )
    
>       with pytest.warns(UserDeprecationWarning, match=expected_warning):
E       Failed: DID NOT WARN. No warnings of type (<class 'openeo.internal.warnings.UserDeprecationWarning'>,) matching the regex were emitted.
E        Regex: Call\ to\ deprecated\ class\ method\ do_plus\.\ \(Usage\ of\ this\ legacy\ class\ method\ is\ deprecated\.\ Use\ `\.add`\ instead\.\)\ \-\-\ Deprecated\ since\ version\ v1\.2\.
E        Emitted warnings: [ UserDeprecationWarning('Call to deprecated function (or staticmethod) do_plus. (Usage of this legacy class method is deprecated. Use `.add` instead.) -- Deprecated since version v1.2.')].

tests/internal/test_warnings.py:111: Failed

@soxofaan
Copy link
Member Author

Already did some digging in that failing warnings test and there seems to be something in legacy_alias that doesn't work anymore under python 3.13. Detection of being a classmethod stopped working.

Maybe something related to https://docs.python.org/3/whatsnew/3.13.html#builtins:

Remove support for chained classmethod descriptors (introduced in gh-63272). These can no longer be used to wrap other descriptors, such as property. The core design of this feature was flawed and led to several problems. To “pass-through” a classmethod, consider using the wrapped attribute that was added in Python 3.10. (Contributed by Raymond Hettinger in gh-89519.)

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

No branches or pull requests

1 participant