Bug 2049619 - python-rich fails to build with Python 3.11: assert "Segment('foo...pe.HOME, 0)])" == "Segment('foo...OME: 3>, 0)])"
Summary: python-rich fails to build with Python 3.11: assert "Segment('foo...pe.HOME, ...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-rich
Version: 37
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Parag Nemade
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.11
TreeView+ depends on / blocked
 
Reported: 2022-02-02 13:20 UTC by Tomáš Hrnčiar
Modified: 2023-05-15 07:42 UTC (History)
3 users (show)

Fixed In Version: python-rich-13.3.5-2.fc39
Clone Of:
Environment:
Last Closed: 2023-05-15 07:42:57 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tomáš Hrnčiar 2022-02-02 13:20:47 UTC
python-rich fails to build with Python 3.11.0a4.

=================================== FAILURES ===================================
________________________ test_inspect_builtin_function _________________________

    def test_inspect_builtin_function():
    
        expected = (
            "╭────────── <built-in function print> ───────────╮\n"
            "│ def print(...)                                 │\n"
            "│                                                │\n"
            "│ print(value, ..., sep=' ', end='\\n',           │\n"
            "│ file=sys.stdout, flush=False)                  │\n"
            "│                                                │\n"
            "│ 29 attribute(s) not shown. Run                 │\n"
            "│ inspect(inspect) for options.                  │\n"
            "╰────────────────────────────────────────────────╯\n"
        )
>       assert expected == render(print)
E       AssertionError: assert '╭────────── ...──────────╯\n' == '╭────────── ...──────────╯\n'
E           ╭────────── <built-in function print> ───────────╮
E         - │ def print(*args, sep=' ', end='\n', file=None, │
E         - │ flush=False):                                  │
E         ?    ^^^^^^^^^^ --
E         + │ def print(...)                                 │
E         ?   ++ ^^^^^^^^^^
E           │                                                │...
E         
E         ...Full output truncated (9 lines hidden), use '-vv' to show

tests/test_inspect.py:137: AssertionError
______________________ test_inspect_integer_with_methods _______________________

    @skip_py36
    @skip_py37
    @skip_py38
    @skip_py39
    def test_inspect_integer_with_methods():
    
        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, *,               │\n"
            "│                    signed=False): Return the   │\n"
            "│                    integer represented by the  │\n"
            "│                    given array of bytes.       │\n"
            "│         to_bytes = def to_bytes(length,        │\n"
            "│                    byteorder, *,               │\n"
            "│                    signed=False): Return an    │\n"
            "│                    array of bytes representing │\n"
            "│                    an integer.                 │\n"
            "╰────────────────────────────────────────────────╯\n"
        )
>       assert expected == render(1, methods=True)
E       AssertionError: assert '╭───────────...──────────╯\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         
E         ...Full output truncated (34 lines hidden), use '-vv' to show

tests/test_inspect.py:242: AssertionError
___________________________________ test_log ___________________________________

    def test_log():
        expected = replace_link_ids(
            "\x1b[2;36m[TIME]\x1b[0m\x1b[2;36m \x1b[0m                                                           \x1b]8;id=0;foo\x1b\\\x1b[2msource.py\x1b[0m\x1b]8;;\x1b\\\x1b[2m:\x1b[0m\x1b]8;id=0;foo\x1b\\\x1b[2m33\x1b[0m\x1b]8;;\x1b\\\n\x1b[2;36m      \x1b[0m\x1b[2;36m \x1b[0mHello from \x1b[1m<\x1b[0m\x1b[1;95mconsole\x1b[0m\x1b[39m \x1b[0m\x1b[33mwidth\x1b[0m\x1b[39m=\x1b[0m\x1b[1;36m80\x1b[0m\x1b[39m ColorSystem.TRUECOLOR\x1b[0m\x1b[1m>\x1b[0m !      \x1b]8;id=0;foo\x1b\\\x1b[2msource.py\x1b[0m\x1b]8;;\x1b\\\x1b[2m:\x1b[0m\x1b]8;id=0;foo\x1b\\\x1b[2m34\x1b[0m\x1b]8;;\x1b\\\n\x1b[2;36m      \x1b[0m\x1b[2;36m \x1b[0m\x1b[1m[\x1b[0m\x1b[1;36m1\x1b[0m, \x1b[1;36m2\x1b[0m, \x1b[1;36m3\x1b[0m\x1b[1m]\x1b[0m                                                  \x1b]8;id=0;foo\x1b\\\x1b[2msource.py\x1b[0m\x1b]8;;\x1b\\\x1b[2m:\x1b[0m\x1b]8;id=0;foo\x1b\\\x1b[2m35\x1b[0m\x1b]8;;\x1b\\\n       \x1b[34m╭─\x1b[0m\x1b[34m───────────────────── \x1b[0m\x1b[3;34mlocals\x1b[0m\x1b[34m ─────────────────────\x1b[0m\x1b[34m─╮\x1b[0m                   \n       \x1b[34m│\x1b[0m \x1b[3;33mconsole\x1b[0m\x1b[31m =\x1b[0m \x1b[1m<\x1b[0m\x1b[1;95mconsole\x1b[0m\x1b[39m \x1b[0m\x1b[33mwidth\x1b[0m\x1b[39m=\x1b[0m\x1b[1;36m80\x1b[0m\x1b[39m ColorSystem.TRUECOLOR\x1b[0m\x1b[1m>\x1b[0m \x1b[34m│\x1b[0m                   \n       \x1b[34m╰────────────────────────────────────────────────────╯\x1b[0m                   \n"
        )
        rendered = render_log()
        print(repr(rendered))
>       assert rendered == expected
E       AssertionError: assert '\x1b[2;36m[T...           \n' == '\x1b[2;36m[T...           \n'
E           [TIME]                                                            ]8;id=0;foo\source.py]8;;\:]8;id=0;foo\33]8;;\
E         -        Hello from <console width=80 ColorSystem.TRUECOLOR> !      ]8;id=0;foo\source.py]8;;\:]8;id=0;foo\34]8;;\
E         ?                                                                                                                         ------------
E         +        H...
E         
E         ...Full output truncated (15 lines hidden), use '-vv' to show

tests/test_log.py:45: AssertionError
----------------------------- Captured stdout call -----------------------------
'\x1b[2;36m[TIME]\x1b[0m\x1b[2;36m \x1b[0m                                                           \x1b]8;id=0;foo\x1b\\\x1b[2msource.py\x1b[0m\x1b]8;;\x1b\\\x1b[2m:\x1b[0m\x1b]8;id=0;foo\x1b\\\x1b[2m33\x1b[0m\x1b]8;;\x1b\\\n\x1b[2;36m      \x1b[0m\x1b[2;36m \x1b[0mHello from \x1b[1m<\x1b[0m\x1b[1;95mconsole\x1b[0m\x1b[39m \x1b[0m\x1b[33mwidth\x1b[0m\x1b[39m=\x1b[0m\x1b[1;36m80\x1b[0m\x1b[39m TRUECOLOR\x1b[0m\x1b[1m>\x1b[0m !                  \x1b]8;id=0;foo\x1b\\\x1b[2msource.py\x1b[0m\x1b]8;;\x1b\\\x1b[2m:\x1b[0m\x1b]8;id=0;foo\x1b\\\x1b[2m34\x1b[0m\x1b]8;;\x1b\\\n\x1b[2;36m      \x1b[0m\x1b[2;36m \x1b[0m\x1b[1m[\x1b[0m\x1b[1;36m1\x1b[0m, \x1b[1;36m2\x1b[0m, \x1b[1;36m3\x1b[0m\x1b[1m]\x1b[0m                                                  \x1b]8;id=0;foo\x1b\\\x1b[2msource.py\x1b[0m\x1b]8;;\x1b\\\x1b[2m:\x1b[0m\x1b]8;id=0;foo\x1b\\\x1b[2m35\x1b[0m\x1b]8;;\x1b\\\n       \x1b[34m╭─\x1b[0m\x1b[34m─────────────── \x1b[0m\x1b[3;34mlocals\x1b[0m\x1b[34m ───────────────\x1b[0m\x1b[34m─╮\x1b[0m                               \n       \x1b[34m│\x1b[0m \x1b[3;33mconsole\x1b[0m\x1b[31m =\x1b[0m \x1b[1m<\x1b[0m\x1b[1;95mconsole\x1b[0m\x1b[39m \x1b[0m\x1b[33mwidth\x1b[0m\x1b[39m=\x1b[0m\x1b[1;36m80\x1b[0m\x1b[39m TRUECOLOR\x1b[0m\x1b[1m>\x1b[0m \x1b[34m│\x1b[0m                               \n       \x1b[34m╰────────────────────────────────────────╯\x1b[0m                               \n'
______________________________ test_attrs_broken _______________________________

    @skip_py36
    @skip_py310
    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=Attr...te \'bar\'"))' == "Foo(bar=Attr...Error('bar'))"
E         - Foo(bar=AttributeError('bar'))
E         + Foo(bar=AttributeError("'Foo' object has no attribute 'bar'"))

tests/test_pretty.py:268: AssertionError
----------------------------- Captured stdout call -----------------------------
'Foo(bar=AttributeError("\'Foo\' object has no attribute \'bar\'"))'
__________________________________ test_repr ___________________________________

    def test_repr():
        assert repr(Segment("foo")) == "Segment('foo')"
        home = (ControlType.HOME, 0)
>       assert (
            repr(Segment("foo", None, [home]))
            == "Segment('foo', None, [(<ControlType.HOME: 3>, 0)])"
        )
E       assert "Segment('foo...pe.HOME, 0)])" == "Segment('foo...OME: 3>, 0)])"
E         - Segment('foo', None, [(<ControlType.HOME: 3>, 0)])
E         ?                        -                ----
E         + Segment('foo', None, [(ControlType.HOME, 0)])

tests/test_segment.py:13: AssertionError
=============================== warnings summary ===============================
tests/test_tabulate.py: 17 warnings
  /builddir/build/BUILD/rich-10.16.1/rich/tabulate.py:32: DeprecationWarning: tabulate_mapping will be deprecated in Rich v11
    warnings.warn("tabulate_mapping will be deprecated in Rich v11", DeprecationWarning)

-- Docs: https://docs.pytest.org/en/stable/warnings.html
=========================== short test summary info ============================
FAILED tests/test_inspect.py::test_inspect_builtin_function - AssertionError:...
FAILED tests/test_inspect.py::test_inspect_integer_with_methods - AssertionEr...
FAILED tests/test_log.py::test_log - AssertionError: assert '\x1b[2;36m[T... ...
FAILED tests/test_pretty.py::test_attrs_broken - assert 'Foo(bar=Attr...te \'...
FAILED tests/test_segment.py::test_repr - assert "Segment('foo...pe.HOME, 0)]...
============ 5 failed, 575 passed, 2 skipped, 17 warnings in 4.96s =============

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

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.11/fedora-rawhide-x86_64/03272362-python-rich/

For all our attempts to build python-rich with Python 3.11, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/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.11:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/

Let us know here if you have any questions.

Python 3.11 is planned to be included in Fedora 37. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.11.
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 Ben Cotton 2022-02-08 20:20:45 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 36 development cycle.
Changing version to 36.

Comment 2 Miro Hrončok 2022-06-22 11:54:18 UTC
The faoling tests were disabled, but I leave this open so we can actually fix it later.

Comment 3 Ben Cotton 2022-08-09 13:12:36 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 37 development cycle.
Changing version to 37.

Comment 4 Parag Nemade 2023-05-11 06:41:24 UTC
It appears tests are no more failing. See
https://kojipkgs.fedoraproject.org//packages/python-rich/13.3.5/2.fc39/data/logs/noarch/build.log
tests/test_inspect.py::test_inspect_builtin_function_except_python311 SKIPPED (rendered differently on py3.11) [ 34%]
tests/test_inspect.py::test_inspect_integer_with_methods_python38_and_python39 SKIPPED (rendered differently on py3.11) [ 34%]
tests/test_log.py::test_log PASSED                                       [ 42%]
tests/test_pretty.py::test_attrs_broken SKIPPED (rendered differently on py3.11) [ 54%]
tests/test_segment.py::test_repr PASSED                                  [ 66%]

I guess we can close this now.


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