Bug 2254184

Summary: python-rich fails to build with Python 3.13: 5 tests fail with AssertionError
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: python-richAssignee: Parag Nemade <pnemade>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: ksurma, mhroncok, pnemade
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: 2023-12-12 15:15:32 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: 2244836    

Description Karolina Surma 2023-12-12 15:05:00 UTC
python-rich fails to build with Python 3.13.0a2.
_________________ test_inspect_integer_with_methods_python311 __________________

    @skip_py37
    @skip_py38
    @skip_py39
    @skip_py310
    @skip_py312
    def test_inspect_integer_with_methods_python311():
        # to_bytes and from_bytes methods on int had minor signature change -
        # they now, as of 3.11, have default values for all of their parameters
        expected = (
            "╭──────────────── <class 'int'> ─────────────────╮\n"
            "│ int([x]) -> integer                            │\n"
            "│ int(x, base=10) -> integer                     │\n"
            "│                                                │\n"
            "│      denominator = 1                           │\n"
            "│             imag = 0                           │\n"
            "│        numerator = 1                           │\n"
            "│             real = 1                           │\n"
            "│ as_integer_ratio = def as_integer_ratio():     │\n"
            "│                    Return integer ratio.       │\n"
            "│        bit_count = def bit_count(): Number of  │\n"
            "│                    ones in the binary          │\n"
            "│                    representation of the       │\n"
            "│                    absolute value of self.     │\n"
            "│       bit_length = def bit_length(): Number of │\n"
            "│                    bits necessary to represent │\n"
            "│                    self in binary.             │\n"
            "│        conjugate = def conjugate(...) Returns  │\n"
            "│                    self, the complex conjugate │\n"
            "│                    of any int.                 │\n"
            "│       from_bytes = def from_bytes(bytes,       │\n"
            "│                    byteorder='big', *,         │\n"
            "│                    signed=False): Return the   │\n"
            "│                    integer represented by the  │\n"
            "│                    given array of bytes.       │\n"
            "│         to_bytes = def to_bytes(length=1,      │\n"
            "│                    byteorder='big', *,         │\n"
            "│                    signed=False): Return an    │\n"
            "│                    array of bytes representing │\n"
            "│                    an integer.                 │\n"
            "╰────────────────────────────────────────────────╯\n"
        )
>       assert render(1, methods=True) == expected
E       assert "╭──────────────── <class 'int'> ─────────────────╮\n│ int([x]) -> integer                            │\n│ int(x, base=10) -> integer                     │\n│                                                │\n│      denominator = 1                           │\n│             imag = 0                           │\n│        numerator = 1                           │\n│             real = 1                           │\n│ as_integer_ratio = def as_integer_ratio():     │\n│                    Return a pair of integers,  │\n│                    whose ratio is equal to the │\n│                    original int.               │\n│        bit_count = def bit_count(): Number of  │\n│                    ones in the binary          │\n│                    representation of the       │\n│                    absolute value of self.     │\n│       bit_length = def bit_length(): Number of │\n│                    bits necessary to represent │\n│                    self in binary.             │\n│        conjugate = def conjugate(): Returns    │\n│                    self, the complex conjugate │\n│                    of any int.                 │\n│       from_bytes = def from_bytes(bytes,       │\n│                    byteorder='big', *,         │\n│                    signed=False): Return the   │\n│                    integer represented by the  │\n│                    given array of bytes.       │\n│       is_integer = def is_integer(): Returns   │\n│                    True. Exists for duck type  │\n│                    compatibility with          │\n│                    float.is_integer.           │\n│         to_bytes = def to_bytes(length=1,      │\n│                    byteorder='big', *,         │\n│                    signed=False): Return an    │\n│                    array of bytes representing │\n│                    an integer.                 │\n╰────────────────────────────────────────────────╯\n" == "╭──────────────── <class 'int'> ─────────────────╮\n│ int([x]) -> integer                            │\n│ int(x, base=10) -> integer                     │\n│                                                │\n│      denominator = 1                           │\n│             imag = 0                           │\n│        numerator = 1                           │\n│             real = 1                           │\n│ as_integer_ratio = def as_integer_ratio():     │\n│                    Return integer ratio.       │\n│        bit_count = def bit_count(): Number of  │\n│                    ones in the binary          │\n│                    representation of the       │\n│                    absolute value of self.     │\n│       bit_length = def bit_length(): Number of │\n│                    bits necessary to represent │\n│                    self in binary.             │\n│        conjugate = def conjugate(...) Returns  │\n│                    self, the complex conjugate │\n│                    of any int.                 │\n│       from_bytes = def from_bytes(bytes,       │\n│                    byteorder='big', *,         │\n│                    signed=False): Return the   │\n│                    integer represented by the  │\n│                    given array of bytes.       │\n│         to_bytes = def to_bytes(length=1,      │\n│                    byteorder='big', *,         │\n│                    signed=False): Return an    │\n│                    array of bytes representing │\n│                    an integer.                 │\n╰────────────────────────────────────────────────╯\n"
E           ╭──────────────── <class 'int'> ─────────────────╮
E           │ int([x]) -> integer                            │
E           │ int(x, base=10) -> integer                     │
E           │                                                │
E           │      denominator = 1                           │
E           │             imag = 0                           │
E           │        numerator = 1                           │
E           │             real = 1                           │
E           │ as_integer_ratio = def as_integer_ratio():     │
E         - │                    Return integer ratio.       │
E         ?                                    ^^^^^^^^^^^^
E         + │                    Return a pair of integers,  │
E         ?                            ++++++++++        ^^
E         + │                    whose ratio is equal to the │
E         + │                    original int.               │
E           │        bit_count = def bit_count(): Number of  │
E           │                    ones in the binary          │
E           │                    representation of the       │
E           │                    absolute value of self.     │
E           │       bit_length = def bit_length(): Number of │
E           │                    bits necessary to represent │
E           │                    self in binary.             │
E         - │        conjugate = def conjugate(...) Returns  │
E         ?                                    ---
E         + │        conjugate = def conjugate(): Returns    │
E         ?                                     +          ++
E           │                    self, the complex conjugate │
E           │                    of any int.                 │
E           │       from_bytes = def from_bytes(bytes,       │
E           │                    byteorder='big', *,         │
E           │                    signed=False): Return the   │
E           │                    integer represented by the  │
E           │                    given array of bytes.       │
E         + │       is_integer = def is_integer(): Returns   │
E         + │                    True. Exists for duck type  │
E         + │                    compatibility with          │
E         + │                    float.is_integer.           │
E           │         to_bytes = def to_bytes(length=1,      │
E           │                    byteorder='big', *,         │
E           │                    signed=False): Return an    │
E           │                    array of bytes representing │
E           │                    an integer.                 │
E           ╰────────────────────────────────────────────────╯

tests/test_inspect.py:338: AssertionError
______________________________ test_attrs_broken _______________________________

    @skip_py310
    @skip_py311
    @skip_py312
    def test_attrs_broken():
        @attr.define
        class Foo:
            bar: int
    
        foo = Foo(1)
        del foo.bar
        result = pretty_repr(foo)
        print(repr(result))
        expected = "Foo(bar=AttributeError('bar'))"
>       assert result == expected
E       assert 'Foo(bar=AttributeError("\'Foo\' object has no attribute \'bar\'"))' == "Foo(bar=AttributeError('bar'))"
E         - Foo(bar=AttributeError('bar'))
E         + Foo(bar=AttributeError("'Foo' object has no attribute 'bar'"))

tests/test_pretty.py:624: AssertionError
----------------------------- Captured stdout call -----------------------------
'Foo(bar=AttributeError("\'Foo\' object has no attribute \'bar\'"))'
=========================== short test summary info ============================
FAILED tests/test_inspect.py::test_inspect_builtin_function_except_python311
FAILED tests/test_inspect.py::test_inspect_integer_with_methods_python38_and_python39
FAILED tests/test_inspect.py::test_inspect_integer_with_methods_python310only
FAILED tests/test_inspect.py::test_inspect_integer_with_methods_python311 - a...
FAILED tests/test_pretty.py::test_attrs_broken - assert 'Foo(bar=AttributeErr...
================== 5 failed, 802 passed, 19 skipped in 6.16s ===================

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/06726092-python-rich/

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

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 Karolina Surma 2023-12-12 15:15:32 UTC

*** This bug has been marked as a duplicate of bug 2203736 ***