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

[BUG] 13.1.0: pytest is failing in two units #2757

Closed
2 tasks done
kloczek opened this issue Jan 15, 2023 · 8 comments
Closed
2 tasks done

[BUG] 13.1.0: pytest is failing in two units #2757

kloczek opened this issue Jan 15, 2023 · 8 comments

Comments

@kloczek
Copy link

kloczek commented Jan 15, 2023

Describe the bug
I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

  • python3 -sBm build -w --no-isolation
  • because I'm calling build with --no-isolation I'm using during all processes only locally installed modules
  • install .whl file in </install/prefix>
  • run pytest with $PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>
  • build is performed in env which is cut off from access to the public network (pytest is executed with -m "not network")

Here is pytest output:

Package                       Version
----------------------------- -----------------
alabaster                     0.7.12
appdirs                       1.4.4
attrs                         22.2.0
Babel                         2.11.0
build                         0.9.0
charset-normalizer            3.0.1
commonmark                    0.9.1
contourpy                     1.0.6
cssselect                     1.1.0
cycler                        0.11.0
distro                        1.8.0
docutils                      0.19
exceptiongroup                1.0.0
extras                        1.0.0
fixtures                      4.0.0
fonttools                     4.38.0
gpg                           1.18.0-unknown
idna                          3.4
imagesize                     1.4.1
importlib-metadata            5.1.0
iniconfig                     1.1.1
Jinja2                        3.1.2
kiwisolver                    1.4.4
libcomps                      0.1.19
lxml                          4.9.1
MarkupSafe                    2.1.1
matplotlib                    3.6.3
numpy                         1.24.1
olefile                       0.46
packaging                     21.3
pbr                           5.9.0
pep517                        0.13.0
Pillow                        9.4.0
pip                           22.3.1
pluggy                        1.0.0
poetry-core                   1.4.0
Pygments                      2.14.0
PyGObject                     3.42.2
pyparsing                     3.0.9
pytest                        7.2.1
python-dateutil               2.8.2
pytz                          2022.4
requests                      2.28.1
rpm                           4.17.0
scour                         0.38.2
setuptools                    65.6.3
six                           1.16.0
snowballstemmer               2.2.0
Sphinx                        5.3.0
sphinx-copybutton             0.5.1
sphinx-rtd-theme              1.1.1
sphinxcontrib-applehelp       1.0.2.dev20221204
sphinxcontrib-devhelp         1.0.2.dev20221204
sphinxcontrib-htmlhelp        2.0.0
sphinxcontrib-jsmath          1.0.1.dev20221204
sphinxcontrib-qthelp          1.0.3.dev20221204
sphinxcontrib-serializinghtml 1.1.5
testtools                     2.5.0
tomli                         2.0.1
typing_extensions             4.4.0
urllib3                       1.26.12
zipp                          3.11.0
@github-actions
Copy link

Thank you for your issue. Give us a little time to review it.

PS. You might want to check the FAQ if you haven't done so already.

This is an automated reply, generated by FAQtory

@willmcgugan
Copy link
Collaborator

What tests are failing?

@kloczek
Copy link
Author

kloczek commented Jan 15, 2023

My fault. By mistake I forgot include pytest output.
Here it is:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-rich-13.1.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-rich-13.1.0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network'
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.8.16, pytest-7.2.1, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/rich-13.1.0, configfile: pyproject.toml, testpaths: tests
collected 791 items

tests/test_align.py ................                                                                                                                                                  [  2%]
tests/test_ansi.py ..                                                                                                                                                                 [  2%]
tests/test_bar.py .......                                                                                                                                                             [  3%]
tests/test_block_bar.py ....                                                                                                                                                          [  3%]
tests/test_box.py ......                                                                                                                                                              [  4%]
tests/test_card.py .                                                                                                                                                                  [  4%]
tests/test_cells.py ...                                                                                                                                                               [  4%]
tests/test_color.py .................                                                                                                                                                 [  7%]
tests/test_color_triplet.py ...                                                                                                                                                       [  7%]
tests/test_columns.py .                                                                                                                                                               [  7%]
tests/test_columns_align.py .                                                                                                                                                         [  7%]
tests/test_console.py .................................................................................................                                                               [ 19%]
tests/test_constrain.py .                                                                                                                                                             [ 20%]
tests/test_containers.py ....                                                                                                                                                         [ 20%]
tests/test_control.py .......                                                                                                                                                         [ 21%]
tests/test_emoji.py ......                                                                                                                                                            [ 22%]
tests/test_file_proxy.py ...                                                                                                                                                          [ 22%]
tests/test_filesize.py ..                                                                                                                                                             [ 22%]
tests/test_getfileno.py ...                                                                                                                                                           [ 23%]
tests/test_highlighter.py ...............................................................................                                                                             [ 33%]
tests/test_inspect.py ....s....ss..................................                                                                                                                   [ 38%]
tests/test_json.py .                                                                                                                                                                  [ 39%]
tests/test_jupyter.py ...                                                                                                                                                             [ 39%]
tests/test_layout.py ......                                                                                                                                                           [ 40%]
tests/test_live.py ..........                                                                                                                                                         [ 41%]
tests/test_live_render.py ....                                                                                                                                                        [ 41%]
tests/test_log.py ...                                                                                                                                                                 [ 42%]
tests/test_logging.py ....                                                                                                                                                            [ 42%]
tests/test_markdown.py ..                                                                                                                                                             [ 43%]
tests/test_markdown_no_hyperlinks.py .                                                                                                                                                [ 43%]
tests/test_markup.py ....................                                                                                                                                             [ 45%]
tests/test_measure.py ....                                                                                                                                                            [ 46%]
tests/test_null_file.py .                                                                                                                                                             [ 46%]
tests/test_padding.py .....                                                                                                                                                           [ 47%]
tests/test_palette.py .                                                                                                                                                               [ 47%]
tests/test_panel.py ..........                                                                                                                                                        [ 48%]
tests/test_pick.py .                                                                                                                                                                  [ 48%]
tests/test_pretty.py ............................................s.....                                                                                                               [ 54%]
tests/test_progress.py ......................................                                                                                                                         [ 59%]
tests/test_prompt.py ......                                                                                                                                                           [ 60%]
tests/test_protocol.py ......                                                                                                                                                         [ 61%]
tests/test_ratio.py .......                                                                                                                                                           [ 62%]
tests/test_repr.py ........                                                                                                                                                           [ 63%]
tests/test_rich_print.py .......                                                                                                                                                      [ 63%]
tests/test_rule.py ................                                                                                                                                                   [ 65%]
tests/test_rule_in_table.py ....                                                                                                                                                      [ 66%]
tests/test_screen.py .                                                                                                                                                                [ 66%]
tests/test_segment.py .................................................                                                                                                               [ 72%]
tests/test_spinner.py .....                                                                                                                                                           [ 73%]
tests/test_stack.py .                                                                                                                                                                 [ 73%]
tests/test_status.py ..                                                                                                                                                               [ 73%]
tests/test_style.py .........................                                                                                                                                         [ 76%]
tests/test_styled.py .                                                                                                                                                                [ 77%]
tests/test_syntax.py ....FF.................                                                                                                                                          [ 80%]
tests/test_table.py ...............                                                                                                                                                   [ 81%]
tests/test_text.py .........................................................................................                                                                          [ 93%]
tests/test_theme.py .....                                                                                                                                                             [ 93%]
tests/test_tools.py ....                                                                                                                                                              [ 94%]
tests/test_traceback.py ...................                                                                                                                                           [ 96%]
tests/test_tree.py .....s.s.                                                                                                                                                          [ 97%]
tests/test_windows_renderer.py sssssssssssssssss                                                                                                                                      [100%]

========================================================================================= FAILURES ==========================================================================================
__________________________________________________________________________ test_python_render_simple_indent_guides __________________________________________________________________________

    def test_python_render_simple_indent_guides():
        syntax = Syntax(
            CODE,
            lexer="python",
            line_numbers=False,
            theme="ansi_light",
            code_width=60,
            word_wrap=False,
            indent_guides=True,
        )
        rendered_syntax = render(syntax)
        print(repr(rendered_syntax))
        expected = '\x1b[34mdef\x1b[0m \x1b[32mloop_first_last\x1b[0m(values: Iterable[T]) -> Iterable[Tuple[\x1b[36mb\x1b[0m\n\x1b[2m│   \x1b[0m\x1b[33m"""Iterate and generate a tuple with a flag for first an\x1b[0m\n\x1b[2m│   \x1b[0miter_values = \x1b[36miter\x1b[0m(values)\n\x1b[2m│   \x1b[0m\x1b[34mtry\x1b[0m:\n\x1b[2m│   │   \x1b[0mprevious_value = \x1b[36mnext\x1b[0m(iter_values)\n\x1b[2m│   \x1b[0m\x1b[34mexcept\x1b[0m \x1b[36mStopIteration\x1b[0m:\n\x1b[2m│   │   \x1b[0m\x1b[34mreturn\x1b[0m\n\x1b[2m│   \x1b[0mfirst = \x1b[34mTrue\x1b[0m\n\x1b[2m│   \x1b[0m\x1b[34mfor\x1b[0m value \x1b[35min\x1b[0m iter_values:\n\x1b[2m│   │   \x1b[0m\x1b[34myield\x1b[0m first, \x1b[34mFalse\x1b[0m, previous_value\n\x1b[2m│   │   \x1b[0mfirst = \x1b[34mFalse\x1b[0m\n\x1b[2m│   │   \x1b[0mprevious_value = value\n\x1b[2m│   \x1b[0m\x1b[34myield\x1b[0m first, \x1b[34mTrue\x1b[0m, previous_value\n'
>       assert rendered_syntax == expected
E       assert '\x1b[34mdef\...vious_value\n' == '\x1b[34mdef\...vious_value\n'
E         Skipping 81 identical leading characters in diff, use -v to show
E           mb
E         - │   """Iterate and generate a tuple with a flag for first an
E         + │   """Iterate and generate a tuple with a flag for first an
E         ?    +++
E           │   iter_values = iter(values)
E           │   try:...
E
E         ...Full output truncated (10 lines hidden), use '-vv' to show

tests/test_syntax.py:114: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
'\x1b[34mdef\x1b[0m \x1b[32mloop_first_last\x1b[0m(values: Iterable[T]) -> Iterable[Tuple[\x1b[36mb\x1b[0m\n\x1b[2;37m│   \x1b[0m\x1b[33m"""Iterate and generate a tuple with a flag for first an\x1b[0m\n\x1b[2m│   \x1b[0miter_values = \x1b[36miter\x1b[0m(values)\n\x1b[2m│   \x1b[0m\x1b[34mtry\x1b[0m:\n\x1b[2m│   │   \x1b[0mprevious_value = \x1b[36mnext\x1b[0m(iter_values)\n\x1b[2m│   \x1b[0m\x1b[34mexcept\x1b[0m \x1b[36mStopIteration\x1b[0m:\n\x1b[2m│   │   \x1b[0m\x1b[34mreturn\x1b[0m\n\x1b[2m│   \x1b[0mfirst = \x1b[34mTrue\x1b[0m\n\x1b[2m│   \x1b[0m\x1b[34mfor\x1b[0m value \x1b[35min\x1b[0m iter_values:\n\x1b[2m│   │   \x1b[0m\x1b[34myield\x1b[0m first, \x1b[34mFalse\x1b[0m, previous_value\n\x1b[2m│   │   \x1b[0mfirst = \x1b[34mFalse\x1b[0m\n\x1b[2m│   │   \x1b[0mprevious_value = value\n\x1b[2m│   \x1b[0m\x1b[34myield\x1b[0m first, \x1b[34mTrue\x1b[0m, previous_value\n'
________________________________________________________________________ test_python_render_line_range_indent_guides ________________________________________________________________________

    def test_python_render_line_range_indent_guides():
        syntax = Syntax(
            CODE,
            lexer="python",
            line_numbers=False,
            theme="ansi_light",
            code_width=60,
            word_wrap=False,
            line_range=(2, 3),
            indent_guides=True,
        )
        rendered_syntax = render(syntax)
        print(repr(rendered_syntax))
        expected = '\x1b[2m│   \x1b[0m\x1b[33m"""Iterate and generate a tuple with a flag for first an\x1b[0m\n\x1b[2m│   \x1b[0miter_values = \x1b[36miter\x1b[0m(values)\n'
>       assert rendered_syntax == expected
E       assert '\x1b[2;37m│ ...[0m(values)\n' == '\x1b[2m│   \...[0m(values)\n'
E         - │   """Iterate and generate a tuple with a flag for first an
E         + │   """Iterate and generate a tuple with a flag for first an
E         ?    +++
E           │   iter_values = iter(values)

tests/test_syntax.py:131: AssertionError
----------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------
'\x1b[2;37m│   \x1b[0m\x1b[33m"""Iterate and generate a tuple with a flag for first an\x1b[0m\n\x1b[2m│   \x1b[0miter_values = \x1b[36miter\x1b[0m(values)\n'
================================================================================== short test summary info ==================================================================================
SKIPPED [1] tests/test_inspect.py:156: print builtin signature only available on 3.11+
SKIPPED [1] tests/test_inspect.py:248: rendered differently on py3.8
SKIPPED [1] tests/test_inspect.py:289: rendered differently on py3.8
SKIPPED [1] tests/test_pretty.py:629: rendered differently on py3.8
SKIPPED [1] tests/test_tree.py:81: Windows specific
SKIPPED [1] tests/test_tree.py:121: Windows specific
SKIPPED [1] tests/test_windows_renderer.py:23: windows only
SKIPPED [1] tests/test_windows_renderer.py:31: windows only
SKIPPED [1] tests/test_windows_renderer.py:41: windows only
SKIPPED [1] tests/test_windows_renderer.py:51: windows only
SKIPPED [1] tests/test_windows_renderer.py:61: windows only
SKIPPED [1] tests/test_windows_renderer.py:69: windows only
SKIPPED [4] tests/test_windows_renderer.py:77: windows only
SKIPPED [3] tests/test_windows_renderer.py:96: windows only
SKIPPED [1] tests/test_windows_renderer.py:112: windows only
SKIPPED [1] tests/test_windows_renderer.py:120: windows only
SKIPPED [1] tests/test_windows_renderer.py:128: windows only
SKIPPED [1] tests/test_windows_renderer.py:136: windows only
FAILED tests/test_syntax.py::test_python_render_simple_indent_guides - assert '\x1b[34mdef\...vious_value\n' == '\x1b[34mdef\...vious_value\n'
FAILED tests/test_syntax.py::test_python_render_line_range_indent_guides - assert '\x1b[2;37m│ ...[0m(values)\n' == '\x1b[2m│   \...[0m(values)\n'
========================================================================= 2 failed, 766 passed, 23 skipped in 6.37s =========================================================================

@daniloegea
Copy link

daniloegea commented Jan 20, 2023

Same tests are failing on the new version 3.2.0

Full output of pytest -vv is here https://pastebin.ubuntu.com/p/QHqJYyzdTp/

@sandrotosi
Copy link

what i think it's happening is that rich tests have been adjusted for pygments 2.14, but the system where OP sees the errors are still running 2.13 (or lower)

@kloczek
Copy link
Author

kloczek commented Jan 22, 2023

I'm during of full rebuild of my disribution.
I'll try when it will be finished (in +2 days) to make test with build with lower pygments verion.
Please keep opened this ticket. I'll try back with results later 😋

@willmcgugan
Copy link
Collaborator

13.3.0 bumps pygments.

@github-actions
Copy link

I hope we solved your problem.

If you like using Rich, you might also enjoy Textual

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

No branches or pull requests

4 participants