Bug 2245884 - python-makefun fails to build with Python 3.13: AssertionError in tests
Summary: python-makefun fails to build with Python 3.13: AssertionError in tests
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-makefun
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Zbigniew Jędrzejewski-Szmek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.13
TreeView+ depends on / blocked
 
Reported: 2023-10-24 13:20 UTC by Karolina Surma
Modified: 2024-06-16 10:00 UTC (History)
5 users (show)

Fixed In Version: python-makefun-1.15.2-5.fc41
Clone Of:
Environment:
Last Closed: 2024-06-16 10:00:55 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Karolina Surma 2023-10-24 13:20:21 UTC
python-makefun fails to build with Python 3.13.0a1.

=================================== FAILURES ===================================
___________________________________ test_doc ___________________________________

    def test_doc():
        def foo(x, y):
            """
            a `foo` function
    
            :param x:
            :param y:
            :return:
            """
            return x + y
    
        ref_bar = functools.partial(foo, x=12)
    
        ref_sig_str = "(x=12, y)" if PY2 else "(*, x=12, y)"
        assert str(signature(ref_bar)) == ref_sig_str
    
        bar = makefun.partial(foo, x=12)
    
        # same behaviour - except in python 2 where our "KW_ONLY_ARG!" appear
        assert str(signature(bar)).replace("=KW_ONLY_ARG!", "") == str(signature(ref_bar))
    
        bar.__name__ = 'bar'
        help(bar)
        with pytest.raises(TypeError):
            bar(1)
        assert bar(y=1) == 13
    
        sig_actual_call = ref_sig_str.replace("*, ", "")
    
>       assert bar.__doc__ \
               == """<This function is equivalent to 'foo%s', see original 'foo' doc below.>
    
            a `foo` function
    
            :param x:
            :param y:
            :return:
            """ % sig_actual_call
E       assert "<This function is equivalent to 'foo(x=12, y)', see original 'foo' doc below.>\n\na `foo` function\n\n:param x:\n:param y:\n:return:\n" == "<This function is equivalent to 'foo(x=12, y)', see original 'foo' doc below.>\n\n        a `foo` function\n\n        :param x:\n        :param y:\n        :return:\n        "
E           <This function is equivalent to 'foo(x=12, y)', see original 'foo' doc below.>
E           
E         -         a `foo` function
E         ? --------
E         + a `foo` function
E           
E         + :param x:
E         + :param y:
E         + :return:
E         -         :param x:
E         -         :param y:
E         -         :return:
E         -

tests/test_partial_and_macros.py:44: AssertionError
----------------------------- Captured stdout call -----------------------------
Help on function bar in module tests.test_partial_and_macros:

bar(*, x=12, y)
    <This function is equivalent to 'foo(x=12, y)', see original 'foo' doc below.>

    a `foo` function

    :param x:
    :param y:
    :return:

_________________________________ test_partial _________________________________

    def test_partial():
        """Tests that `with_partial` works"""
    
        @makefun.with_partial(y='hello')
        def foo(x, y, a):
            """
            a `foo` function
    
            :param x:
            :param y:
            :param a:
            :return:
            """
            print(a)
            print(x, y)
    
        if not PY2:
            # true keyword-only
            with pytest.raises(TypeError):
                foo(1, 2)
    
        foo(1, a=2)
        help(foo)
    
        sig_actual_call = "(x, y='hello', a)"  # if PY2 else "(x, *, y='hello', a)"
    
>       assert foo.__doc__.replace("=KW_ONLY_ARG!", "") \
               == """<This function is equivalent to 'foo%s', see original 'foo' doc below.>
    
            a `foo` function
    
            :param x:
            :param y:
            :param a:
            :return:
            """ % sig_actual_call
E       assert "<This function is equivalent to 'foo(x, y='hello', a)', see original 'foo' doc below.>\n\na `foo` function\n\n:param x:\n:param y:\n:param a:\n:return:\n" == "<This function is equivalent to 'foo(x, y='hello', a)', see original 'foo' doc below.>\n\n        a `foo` function\n\n        :param x:\n        :param y:\n        :param a:\n        :return:\n        "
E           <This function is equivalent to 'foo(x, y='hello', a)', see original 'foo' doc below.>
E           
E         -         a `foo` function
E         ? --------
E         + a `foo` function
E           
E         + :param x:
E         + :param y:
E         + :param a:
E         + :return:
E         -         :param x:
E         -         :param y:
E         -         :param a:
E         -         :return:
E         -

tests/test_partial_and_macros.py:81: AssertionError
----------------------------- Captured stdout call -----------------------------
2
1 hello
Help on function foo in module tests.test_partial_and_macros:

foo(x, *, y='hello', a)
    <This function is equivalent to 'foo(x, y='hello', a)', see original 'foo' doc below.>

    a `foo` function

    :param x:
    :param y:
    :param a:
    :return:

=========================== short test summary info ============================
FAILED tests/test_partial_and_macros.py::test_doc - assert "<This function is...
FAILED tests/test_partial_and_macros.py::test_partial - assert "<This functio...
============== 2 failed, 91 passed, 2 skipped, 1 warning in 0.40s ==============

https://docs.python.org/3.13/whatsnew/3.13.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.13/fedora-rawhide-x86_64/06546802-python-makefun/

For all our attempts to build python-makefun with Python 3.13, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.13/package/python-makefun/

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.13:
https://copr.fedorainfracloud.org/coprs/g/python/python3.13/

Let us know here if you have any questions.

Python 3.13 is planned to be included in Fedora 41.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.13.
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.

Comment 1 Aoife Moloney 2024-02-15 23:01:33 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 40 development cycle.
Changing version to 40.


Note You need to log in before you can comment on or make changes to this bug.