--- Begin Message ---
Source: rich
Version: 9.11.0-1
Severity: important
Hello, looks like the testsuite is failing with TERM=unknown, I don't really
know why, but calling dh_auto_test with TERM=linux seems to fix it.
override_dh_auto_test:
TERM=linux PYBUILD_SYSTEM=custom
PYBUILD_TEST_ARGS="PYTHONPATH=$(CURDIR) {interpreter} -m pytest" dh_auto_test
I'm not adding the tag "patch" because some bug in the code probably exists.
Example of failure:
https://launchpadlibrarian.net/524437846/buildlog_ubuntu-hirsute-amd64.rich_9.11.0-1_BUILDING.txt.gz
APT_CONFIG=/var/lib/sbuild/apt.conf
DEB_BUILD_OPTIONS=parallel=4
HOME=/sbuild-nonexistent
LANG=C.UTF-8
LC_ALL=C.UTF-8
LOGNAME=buildd
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
SCHROOT_ALIAS_NAME=build-PACKAGEBUILD-21056332
SCHROOT_CHROOT_NAME=build-PACKAGEBUILD-21056332
SCHROOT_COMMAND=env
SCHROOT_GID=2501
SCHROOT_GROUP=buildd
SCHROOT_SESSION_ID=build-PACKAGEBUILD-21056332
SCHROOT_UID=2001
SCHROOT_USER=buildd
SHELL=/bin/sh
TERM=unknown
USER=buildd
V=1
dpkg-buildpackage
-----------------
dpkg-buildpackage: info: source package rich
dpkg-buildpackage: info: source version 9.11.0-1
dpkg-buildpackage: info: source distribution unstable
dpkg-source --before-build .
dpkg-buildpackage: info: host architecture amd64
dpkg-source: info: using options from rich-9.11.0/debian/source/options:
--extend-diff-ignore=^[^/]+.egg-info/
fakeroot debian/rules clean
dh clean --with python3 --buildsystem=pybuild
dh_auto_clean -O--buildsystem=pybuild
I: pybuild base:232: python3.9 setup.py clean
running clean
removing '/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9_rich/build' (and everything
under it)
'build/bdist.linux-x86_64' does not exist -- can't clean it
'build/scripts-3.9' does not exist -- can't clean it
dh_autoreconf_clean -O--buildsystem=pybuild
dh_clean -O--buildsystem=pybuild
debian/rules build
dh build --with python3 --buildsystem=pybuild
dh_update_autotools_config -O--buildsystem=pybuild
dh_autoreconf -O--buildsystem=pybuild
dh_auto_configure -O--buildsystem=pybuild
I: pybuild base:232: python3.9 setup.py config
running config
dh_auto_build -O--buildsystem=pybuild
I: pybuild base:232: /usr/bin/python3 setup.py build
running build
debian/rules override_dh_auto_test
make[1]: Entering directory '/<<PKGBUILDDIR>>'
PYBUILD_SYSTEM=custom PYBUILD_TEST_ARGS="PYTHONPATH=/<<PKGBUILDDIR>>
{interpreter} -m pytest" dh_auto_test
I: pybuild base:232: PYTHONPATH=/<<PKGBUILDDIR>> python3.9 -m pytest
============================= test session starts ==============================
platform linux -- Python 3.9.2, pytest-6.0.2, py-1.10.0, pluggy-0.13.0
rootdir: /<<PKGBUILDDIR>>
collected 464 items
tests/test_align.py ..........F..... [ 3%]
tests/test_ansi.py . [ 3%]
tests/test_bar.py ....... [ 5%]
tests/test_block_bar.py .... [ 6%]
tests/test_box.py ...... [ 7%]
tests/test_card.py . [ 7%]
tests/test_cells.py . [ 7%]
tests/test_color.py ................ [ 11%]
tests/test_color_triplet.py ... [ 11%]
tests/test_columns.py . [ 12%]
tests/test_columns_align.py . [ 12%]
tests/test_console.py F............FF.....F......FFF.FFF.........F...... [ 23%]
...FF. [ 24%]
tests/test_constrain.py . [ 24%]
tests/test_containers.py .... [ 25%]
tests/test_control.py .. [ 25%]
tests/test_emoji.py .... [ 26%]
tests/test_file_proxy.py .. [ 27%]
tests/test_filesize.py .. [ 27%]
tests/test_highlighter.py ..................................... [ 35%]
tests/test_inspect.py ........ [ 37%]
tests/test_jupyter.py . [ 37%]
tests/test_layout.py .. [ 37%]
tests/test_live.py .FFFFF.F.F [ 40%]
tests/test_live_render.py .... [ 40%]
tests/test_log.py .. [ 41%]
tests/test_logging.py FF [ 41%]
tests/test_lrucache.py . [ 42%]
tests/test_markdown.py .. [ 42%]
tests/test_markdown_no_hyperlinks.py . [ 42%]
tests/test_markup.py ............... [ 45%]
tests/test_measure.py ..... [ 46%]
tests/test_padding.py ..... [ 48%]
tests/test_palette.py . [ 48%]
tests/test_panel.py ........ [ 50%]
tests/test_pick.py . [ 50%]
tests/test_pretty.py ................ [ 53%]
tests/test_progress.py .........FFFFF......F [ 58%]
tests/test_prompt.py ...... [ 59%]
tests/test_protocol.py ... [ 60%]
tests/test_ratio.py ....... [ 61%]
tests/test_rich_print.py .... [ 62%]
tests/test_rule.py F..FF.. [ 64%]
tests/test_screen.py . [ 64%]
tests/test_segment.py ............... [ 67%]
tests/test_spinner.py ... [ 68%]
tests/test_stack.py . [ 68%]
tests/test_status.py .. [ 68%]
tests/test_style.py ...................... [ 73%]
tests/test_styled.py F [ 73%]
tests/test_syntax.py ............ [ 76%]
tests/test_table.py F.... [ 77%]
tests/test_tabulate.py . [ 77%]
tests/test_text.py ..................................................... [ 89%]
........................ [ 94%]
tests/test_theme.py ..... [ 95%]
tests/test_tools.py .... [ 96%]
tests/test_traceback.py ............ [ 98%]
tests/test_tree.py ....s. [100%]
=================================== FAILURES ===================================
____________________________ test_align_right_style ____________________________
def test_align_right_style():
console = Console(
file=io.StringIO(), width=10, color_system="truecolor",
force_terminal=True
)
console.print(Align("foo", "right", style="on blue"))
> assert console.file.getvalue() == "\x1b[44m
> \x1b[0m\x1b[44mfoo\x1b[0m\n"
E AssertionError: assert '\x1b[44m ...mfoo\x1b[0m\n' == '\x1b[44m
...mfoo\x1b[0m\n'
E - [44m [0m[44mfoo[0m
E + [44m
[0m[44mfoo[0m
tests/test_align.py:101: AssertionError
______________________________ test_dumb_terminal ______________________________
def test_dumb_terminal():
console = Console(force_terminal=True)
> assert console.color_system is not None
E assert None is not None
E + where None = <console width=80 None>.color_system
tests/test_console.py:29: AssertionError
_______________________________ test_show_cursor _______________________________
def test_show_cursor():
console = Console(file=io.StringIO(), force_terminal=True,
legacy_windows=False)
console.show_cursor(False)
console.print("foo")
console.show_cursor(True)
> assert console.file.getvalue() == "\x1b[?25lfoo\n\x1b[?25h"
E AssertionError: assert 'foo\n' == '\x1b[?25lfoo\n\x1b[?25h'
E + foo
E - [?25lfoo
E - [?25h
tests/test_console.py:168: AssertionError
__________________________________ test_clear __________________________________
def test_clear():
console = Console(file=io.StringIO(), force_terminal=True)
console.clear()
console.clear(home=False)
> assert console.file.getvalue() == "\033[2J\033[H" + "\033[2J"
E AssertionError: assert '' == '\x1b[2J\x1b[H\x1b[2J'
E - [2J[H[2J
tests/test_console.py:175: AssertionError
_________________________________ test_control _________________________________
def test_control():
console = Console(file=io.StringIO(), force_terminal=True)
console.control("FOO")
console.print("BAR")
> assert console.file.getvalue() == "FOOBAR\n"
E AssertionError: assert 'BAR\n' == 'FOOBAR\n'
E - FOOBAR
E + BAR
tests/test_console.py:213: AssertionError
______________________________ test_justify_left _______________________________
def test_justify_left():
console = Console(file=io.StringIO(), force_terminal=True, width=20)
console.print("FOO", justify="left")
> assert console.file.getvalue() == "FOO \n"
E AssertionError: assert 'FOO ... \n' == 'FOO
\n'
E - FOO
E + FOO
tests/test_console.py:278: AssertionError
_____________________________ test_justify_center ______________________________
def test_justify_center():
console = Console(file=io.StringIO(), force_terminal=True, width=20)
console.print("FOO", justify="center")
> assert console.file.getvalue() == " FOO \n"
E AssertionError: assert ' ... \n' == ' FOO
\n'
E - FOO
E + FOO
tests/test_console.py:284: AssertionError
______________________________ test_justify_right ______________________________
def test_justify_right():
console = Console(file=io.StringIO(), force_terminal=True, width=20)
console.print("FOO", justify="right")
> assert console.file.getvalue() == " FOO\n"
E AssertionError: assert ' ... FOO\n' == '
FOO\n'
E - FOO
E +
FOO
tests/test_console.py:290: AssertionError
_________________________ test_justify_renderable_left _________________________
def test_justify_renderable_left():
console = Console(
file=io.StringIO(), force_terminal=True, width=10,
legacy_windows=False
)
console.print(Panel("FOO", expand=False, padding=0), justify="left")
> assert console.file.getvalue() == "╭───╮ \n│FOO│ \n╰───╯ \n"
E AssertionError: assert '╭───╮ ... \n' == '╭───╮
\n...n╰───╯ \n'
E - ╭───╮
E - │FOO│
E - ╰───╯
E + ╭───╮
E + │FOO│
E + ╰───╯
tests/test_console.py:306: AssertionError
________________________ test_justify_renderable_center ________________________
def test_justify_renderable_center():
console = Console(
file=io.StringIO(), force_terminal=True, width=10,
legacy_windows=False
)
console.print(Panel("FOO", expand=False, padding=0), justify="center")
> assert console.file.getvalue() == " ╭───╮ \n │FOO│ \n ╰───╯ \n"
E AssertionError: assert ' ... \n' == ' ╭───╮
\n...n ╰───╯ \n'
E - ╭───╮
E - │FOO│
E - ╰───╯
E + ╭───╮
E + │FOO│
E + ╰───╯
tests/test_console.py:314: AssertionError
________________________ test_justify_renderable_right _________________________
def test_justify_renderable_right():
console = Console(
file=io.StringIO(), force_terminal=True, width=20,
legacy_windows=False
)
console.print(Panel("FOO", expand=False, padding=0), justify="right")
> assert (
console.file.getvalue()
== " ╭───╮\n │FOO│\n
╰───╯\n"
)
E AssertionError: assert ' ... ╰───╯\n' == '
... ╰───╯\n'
E - ╭───╮
E - │FOO│
E - ╰───╯
E +
╭───╮
E +
│FOO│
E +
╰───╯
tests/test_console.py:322: AssertionError
__________________________________ test_bell ___________________________________
def test_bell() -> None:
console = Console(force_terminal=True)
console.begin_capture()
console.bell()
> assert console.end_capture() == "\x07"
E AssertionError: assert '' == '\x07'
E -
tests/test_console.py:412: AssertionError
_________________________________ test_screen __________________________________
@pytest.mark.skipif(sys.platform == "win32", reason="does not run on
windows")
def test_screen():
console = Console(color_system=None, force_terminal=True,
force_interactive=True)
with console.capture() as capture:
with console.screen():
console.print("Don't panic")
expected = "\x1b[?1049h\x1b[H\x1b[?25lDon't panic\n\x1b[?1049l\x1b[?25h"
result = capture.get()
print(repr(result))
> assert result == expected
E assert "Don't panic\n" == '\x1b[?1049h\...049l\x1b[?25h'
E + Don't panic
E - [?1049h[H[?25lDon't panic
E - [?1049l[?25h
tests/test_console.py:526: AssertionError
----------------------------- Captured stdout call -----------------------------
"Don't panic\n"
______________________________ test_screen_update ______________________________
@pytest.mark.skipif(sys.platform == "win32", reason="does not run on
windows")
def test_screen_update():
console = Console(width=20, height=4, color_system="truecolor",
force_terminal=True)
with console.capture() as capture:
with console.screen() as screen:
screen.update("foo", style="blue")
screen.update("bar")
screen.update()
result = capture.get()
print(repr(result))
expected = "\x1b[?1049h\x1b[H\x1b[?25l\x1b[34mfoo\x1b[0m\x1b[34m
\x1b[0m\n\x1b[34m \x1b[0m\n\x1b[34m
\x1b[0m\n\x1b[34m \x1b[0m\x1b[34mbar\x1b[0m\x1b[34m
\x1b[0m\n\x1b[34m \x1b[0m\n\x1b[34m
\x1b[0m\n\x1b[34m \x1b[0m\x1b[34mbar\x1b[0m\x1b[34m
\x1b[0m\n\x1b[34m \x1b[0m\n\x1b[34m
\x1b[0m\n\x1b[34m \x1b[0m\x1b[?1049l\x1b[?25h"
> assert result == expected
E AssertionError: assert '\x1b[34mfoo\... \x1b[0m' ==
'\x1b[?1049h\...049l\x1b[?25h'
E - [?1049h[H[?25l[34mfoo[0m[34m [0m
E ? -----------------
E + [34mfoo[0m[34m [0m
E [34m [0m
E [34m [0m
E [34m [0m[34mbar[0m[34m [0m
E [34m [0m...
E
E ...Full output truncated (8 lines hidden), use '-vv' to show
tests/test_console.py:540: AssertionError
----------------------------- Captured stdout call -----------------------------
'\x1b[34mfoo\x1b[0m\x1b[34m \x1b[0m\n\x1b[34m
\x1b[0m\n\x1b[34m \x1b[0m\n\x1b[34m
\x1b[0m\x1b[34mbar\x1b[0m\x1b[34m \x1b[0m\n\x1b[34m
\x1b[0m\n\x1b[34m \x1b[0m\n\x1b[34m
\x1b[0m\x1b[34mbar\x1b[0m\x1b[34m \x1b[0m\n\x1b[34m
\x1b[0m\n\x1b[34m \x1b[0m\n\x1b[34m
\x1b[0m'
_____________________________ test_growing_display _____________________________
def test_growing_display() -> None:
console = create_capture_console()
console.begin_capture()
with Live(console=console, auto_refresh=False) as live:
display = ""
for step in range(10):
display += f"Step {step}\n"
live.update(display, refresh=True)
output = console.end_capture()
print(repr(output))
> assert (
output
== "\x1b[?25lStep 0\n\r\x1b[2K\x1b[1A\x1b[2KStep 0\nStep
1\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep 0\nStep 1\nStep
2\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep 0\nStep 1\nStep
2\nStep
3\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep 3\nStep
4\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep 3\nStep 4\nStep
5\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep 3\nStep 4\nStep 5\nStep
6\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep 3\nStep 4\nStep 5\nStep 6\nStep
7\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep 3\nStep 4\nStep 5\nStep 6\nStep 7\nStep
8\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep 3\nStep 4\nStep 5\nStep 6\nStep 7\nStep 8\nStep
9\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep 3\nStep 4\nStep 5\nStep 6\nStep 7\nStep 8\nStep
9\n\n\x1b[?25h"
)
E AssertionError: assert 'Step 0\nStep...8\nStep 9\n\n' ==
'\x1b[?25lSte...\n\n\x1b[?25h'
E - [?25lStep 0
E -
E - [2K[1A[2KStep 0
E - Step 1
E ? ^
E + Step 0
E ? ^...
E
E ...Full output truncated (74 lines hidden), use '-vv' to show
tests/test_live.py:49: AssertionError
----------------------------- Captured stdout call -----------------------------
'Step 0\nStep 1\nStep 2\nStep 3\nStep 4\nStep 5\nStep 6\nStep 7\nStep 8\nStep
9\n\n'
________________________ test_growing_display_transient ________________________
def test_growing_display_transient() -> None:
console = create_capture_console()
console.begin_capture()
with Live(console=console, auto_refresh=False, transient=True) as live:
display = ""
for step in range(10):
display += f"Step {step}\n"
live.update(display, refresh=True)
output = console.end_capture()
> assert (
output
== "\x1b[?25lStep 0\n\r\x1b[2K\x1b[1A\x1b[2KStep 0\nStep
1\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep 0\nStep 1\nStep
2\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep 0\nStep 1\nStep
2\nStep
3\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep 3\nStep
4\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep 3\nStep 4\nStep
5\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep 3\nStep 4\nStep 5\nStep
6\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep 3\nStep 4\nStep 5\nStep 6\nStep
7\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep 3\nStep 4\nStep 5\nStep 6\nStep 7\nStep
8\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep 3\nStep 4\nStep 5\nStep 6\nStep 7\nStep 8\nStep
9\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep 3\nStep 4\nStep 5\nStep 6\nStep 7\nStep 8\nStep
9\n\n\x1b[?25h\r\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K"
)
E AssertionError: assert '\n' == '\x1b[?25lSte...x1b[1A\x1b[2K'
E Strings contain only whitespace, escaping them using repr()
E - '\x1b[?25lStep 0\n\r\x1b[2K\x1b[1A\x1b[2KStep 0\nStep
1\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep 0\nStep 1\nStep
2\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep 0\nStep 1\nStep
2\nStep
3\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep 3\nStep
4\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep 3\nStep 4\nStep
5\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\...
E
E ...Full output truncated (2 lines hidden), use '-vv' to show
tests/test_live.py:64: AssertionError
____________________ test_growing_display_overflow_ellipsis ____________________
def test_growing_display_overflow_ellipsis() -> None:
console = create_capture_console(height=5)
console.begin_capture()
with Live(
console=console, auto_refresh=False, vertical_overflow="ellipsis"
) as live:
display = ""
for step in range(10):
display += f"Step {step}\n"
live.update(display, refresh=True)
output = console.end_capture()
> assert (
output
== "\x1b[?25lStep 0\n\r\x1b[2K\x1b[1A\x1b[2KStep 0\nStep
1\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep 0\nStep 1\nStep
2\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep 0\nStep 1\nStep
2\nStep
3\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep 3\n ...
\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep 3\n ...
\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep 3\n ...
\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep 3\n ...
\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep 3\n ...
\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep 3\n ...
\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep 3\nStep 4\nStep 5\nStep 6\nStep 7\nStep 8\nStep
9\n\n\x1b[?25h"
)
E AssertionError: assert 'Step 0\nStep...8\nStep 9\n\n' ==
'\x1b[?25lSte...\n\n\x1b[?25h'
E - [?25lStep 0
E -
E - [2K[1A[2KStep 0
E - Step 1
E ? ^
E + Step 0
E ? ^...
E
E ...Full output truncated (53 lines hidden), use '-vv' to show
tests/test_live.py:81: AssertionError
______________________ test_growing_display_overflow_crop ______________________
def test_growing_display_overflow_crop() -> None:
console = create_capture_console(height=5)
console.begin_capture()
with Live(console=console, auto_refresh=False,
vertical_overflow="crop") as live:
display = ""
for step in range(10):
display += f"Step {step}\n"
live.update(display, refresh=True)
output = console.end_capture()
> assert (
output
== "\x1b[?25lStep 0\n\r\x1b[2K\x1b[1A\x1b[2KStep 0\nStep
1\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep 0\nStep 1\nStep
2\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep 0\nStep 1\nStep
2\nStep
3\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep 3\nStep
4\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep 0\nStep
1\nStep 2\nStep 3\nStep
4\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep 0\nStep
1\nStep 2\nStep 3\nStep
4\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep 0\nStep
1\nStep 2\nStep 3\nStep
4\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep 0\nStep
1\nStep 2\nStep 3\nStep
4\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep 0\nStep
1\nStep 2\nStep 3\nStep
4\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep 0\nStep
1\nStep 2\nStep 3\nStep 4\nStep 5\nStep 6\nStep 7\nStep 8\nStep 9\n\n\x1b[?25h"
)
E AssertionError: assert 'Step 0\nStep...8\nStep 9\n\n' ==
'\x1b[?25lSte...\n\n\x1b[?25h'
E - [?25lStep 0
E -
E - [2K[1A[2KStep 0
E - Step 1
E ? ^
E + Step 0
E ? ^...
E
E ...Full output truncated (53 lines hidden), use '-vv' to show
tests/test_live.py:96: AssertionError
____________________ test_growing_display_overflow_visible _____________________
def test_growing_display_overflow_visible() -> None:
console = create_capture_console(height=5)
console.begin_capture()
with Live(console=console, auto_refresh=False,
vertical_overflow="visible") as live:
display = ""
for step in range(10):
display += f"Step {step}\n"
live.update(display, refresh=True)
output = console.end_capture()
> assert (
output
== "\x1b[?25lStep 0\n\r\x1b[2K\x1b[1A\x1b[2KStep 0\nStep
1\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep 0\nStep 1\nStep
2\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep 0\nStep 1\nStep
2\nStep
3\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep 3\nStep
4\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep 3\nStep 4\nStep
5\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep 3\nStep 4\nStep 5\nStep
6\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep 3\nStep 4\nStep 5\nStep 6\nStep
7\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep 3\nStep 4\nStep 5\nStep 6\nStep 7\nStep
8\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep 3\nStep 4\nStep 5\nStep 6\nStep 7\nStep 8\nStep
9\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep 3\nStep 4\nStep 5\nStep 6\nStep 7\nStep 8\nStep
9\n\n\x1b[?25h"
)
E AssertionError: assert 'Step 0\nStep...8\nStep 9\n\n' ==
'\x1b[?25lSte...\n\n\x1b[?25h'
E - [?25lStep 0
E -
E - [2K[1A[2KStep 0
E - Step 1
E ? ^
E + Step 0
E ? ^...
E
E ...Full output truncated (74 lines hidden), use '-vv' to show
tests/test_live.py:111: AssertionError
____________________ test_growing_display_console_redirect _____________________
def test_growing_display_console_redirect() -> None:
console = create_capture_console()
console.begin_capture()
with Live(console=console, auto_refresh=False) as live:
display = ""
for step in range(10):
console.print(f"Running step {step}")
display += f"Step {step}\n"
live.update(display, refresh=True)
output = console.end_capture()
> assert (
output
== "\x1b[?25lRunning step 0\n\r\x1b[2KStep
0\n\r\x1b[2K\x1b[1A\x1b[2KRunning step 1\nStep 0\n\r\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KRunning step 2\nStep 0\nStep
1\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep 0\nStep 1\nStep
2\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KRunning step 3\nStep
0\nStep 1\nStep 2\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep
3\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KRunning
step 4\nStep 0\nStep 1\nStep 2\nStep
3\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep 3\nStep
4\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KRunning
step 5\nStep 0\nStep 1\nStep 2\nStep 3\nStep
4\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep 3\nStep 4\nStep
5\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KRunning
step 6\nStep 0\nStep 1\nStep 2\nStep 3\nStep 4\nStep
5\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep 3\nStep 4\nStep 5\nStep
6\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KRunning
step 7\nStep 0\nStep 1\nStep 2\nStep 3\nStep 4\nStep 5\nStep
6\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep 3\nStep 4\nStep 5\nStep 6\nStep
7\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KRunning
step 8\nStep 0\nStep 1\nStep 2\nStep 3\nStep 4\nStep 5\nStep 6\nStep
7\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep 3\nStep 4\nStep 5\nStep 6\nStep 7\nStep
8\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KRunning
step 9\nStep 0\nStep 1\nStep 2\nStep 3\nStep 4\nStep 5\nStep 6\nStep 7\nStep
8\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep 3\nStep 4\nStep 5\nStep 6\nStep 7\nStep 8\nStep
9\n\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2KStep
0\nStep 1\nStep 2\nStep 3\nStep 4\nStep 5\nStep 6\nStep 7\nStep 8\nStep
9\n\n\x1b[?25h"
)
E AssertionError: assert 'Running step...8\nStep 9\n\n' ==
'\x1b[?25lRun...\n\n\x1b[?25h'
E - [?25lRunning step 0
E ? ------
E + Running step 0
E -
E - [2KStep 0
E -
E - [2K[1A[2KRunning step 1...
E
E ...Full output truncated (147 lines hidden), use '-vv' to show
tests/test_live.py:143: AssertionError
_______________________________ test_live_screen _______________________________
def test_live_screen() -> None:
console = create_capture_console(width=20, height=5)
console.begin_capture()
with Live(Text("foo"), screen=True, console=console,
auto_refresh=False) as live:
live.refresh()
result = console.end_capture()
print(repr(result))
expected = "\x1b[?1049h\x1b[H\x1b[?25l\x1b[Hfoo \n
\n \n \n
\x1b[Hfoo \n \n \n
\n \x1b[?25h\x1b[?1049l"
> assert result == expected
E AssertionError: assert '' == '\x1b[?1049h\...5h\x1b[?1049l'
E - [?1049h[H[?25l[Hfoo
E -
E -
E -
E - [Hfoo
E -
E - ...
E
E ...Full output truncated (3 lines hidden), use '-vv' to show
tests/test_live.py:172: AssertionError
----------------------------- Captured stdout call -----------------------------
''
________________________________ test_exception ________________________________
@skip_win
def test_exception():
console = Console(
file=io.StringIO(), force_terminal=True, width=140,
color_system="truecolor"
)
handler_with_tracebacks = RichHandler(
console=console, enable_link_path=False, rich_tracebacks=True
)
log.addHandler(handler_with_tracebacks)
try:
1 / 0
except ZeroDivisionError:
log.exception("message")
render = handler_with_tracebacks.console.file.getvalue()
print(render)
assert "ZeroDivisionError" in render
assert "message" in render
> assert "division by zero" in render
E AssertionError: assert 'division by zero' in '\x1b[2;36m[02/22/21
11:41:25]\x1b[0m\x1b[2;36m \x1b[0m\x1b[1;31mERROR \x1b[0m message
\x1b...0mdivision by \n
zero \n'
tests/test_logging.py:48: AssertionError
----------------------------- Captured stdout call -----------------------------
[2;36m[02/22/21 11:41:25][0m[2;36m [0m[1;31mERROR [0m message
[2mtest_logging.py[0m[2m:41[0m
[91m╭─[0m[91m [0m[1;31mTraceback
[0m[1;2;31m(most recent call[0m[91m─╮[0m
[91m│[0m [2;33m/<<BUILDDIR>>/rich-9.11[0m
[91m│[0m
[91m│[0m
[2;33m.0/tests/[0m[1;33mtest_logging.py[0m:[94m39[0m [91m│[0m
[91m│[0m in [92mtest_exception[0m
[91m│[0m
[91m│[0m [91m│[0m
[91m│[0m [2m36 [0m[2m│
[0mlog.addHandler(hand [91m│[0m
[91m│[0m [2m37 [0m[2m│ [0m
[91m│[0m
[91m│[0m [2m38 [0m[2m│ [0m[94mtry[0m:
[91m│[0m
[91m│[0m [31m❱ [0m39 [2m│ │
[0m[94m1[0m / [94m0[0m [91m│[0m
[91m│[0m [2m40 [0m[2m│
[0m[94mexcept[0m [96mZeroDivision[0m [91m│[0m
[91m│[0m [2m41 [0m[2m│ │
[0mlog.exception([33m"[0m [91m│[0m
[91m╰──────────────────────────────╯[0m
[1;91mZeroDivisionError: [0mdivision by
zero
------------------------------ Captured log call -------------------------------
ERROR rich:test_logging.py:41 message
Traceback (most recent call last):
File "/<<PKGBUILDDIR>>/tests/test_logging.py", line 39, in test_exception
1 / 0
ZeroDivisionError: division by zero
_______________________ test_exception_with_extra_lines ________________________
def test_exception_with_extra_lines():
console = Console(
file=io.StringIO(), force_terminal=True, width=140,
color_system="truecolor"
)
handler_extra_lines = RichHandler(
console=console,
enable_link_path=False,
markup=True,
rich_tracebacks=True,
tracebacks_extra_lines=5,
)
log.addHandler(handler_extra_lines)
try:
1 / 0
except ZeroDivisionError:
log.exception("message")
render = handler_extra_lines.console.file.getvalue()
print(render)
assert "ZeroDivisionError" in render
assert "message" in render
> assert "division by zero" in render
E AssertionError: assert 'division by zero' in '\x1b[2;36m[02/22/21
11:41:25]\x1b[0m\x1b[2;36m \x1b[0m\x1b[1;31mERROR \x1b[0m message
\x1b...0mdivision by \n
zero \n'
tests/test_logging.py:74: AssertionError
----------------------------- Captured stdout call -----------------------------
[2;36m[02/22/21 11:41:25][0m[2;36m [0m[1;31mERROR [0m message
[2mtest_logging.py[0m[2m:67[0m
[91m╭─[0m[91m [0m[1;31mTraceback
[0m[1;2;31m(most recent call[0m[91m─╮[0m
[91m│[0m [2;33m/<<BUILDDIR>>/rich-9.11[0m
[91m│[0m
[91m│[0m
[2;33m.0/tests/[0m[1;33mtest_logging.py[0m:[94m65[0m [91m│[0m
[91m│[0m in [92mtest_exception_with_extra[0m
[91m│[0m
[91m│[0m [92m_lines[0m
[91m│[0m
[91m│[0m [91m│[0m
[91m│[0m [2m60 [0m[2m│ │
[0mtracebacks_extr [91m│[0m
[91m│[0m [2m61 [0m[2m│ [0m)
[91m│[0m
[91m│[0m [2m62 [0m[2m│
[0mlog.addHandler(hand [91m│[0m
[91m│[0m [2m63 [0m[2m│ [0m
[91m│[0m
[91m│[0m [2m64 [0m[2m│ [0m[94mtry[0m:
[91m│[0m
[91m│[0m [31m❱ [0m65 [2m│ │
[0m[94m1[0m / [94m0[0m [91m│[0m
[91m│[0m [2m66 [0m[2m│
[0m[94mexcept[0m [96mZeroDivision[0m [91m│[0m
[91m│[0m [2m67 [0m[2m│ │
[0mlog.exception([33m"[0m [91m│[0m
[91m│[0m [2m68 [0m[2m│ [0m
[91m│[0m
[91m│[0m [2m69 [0m[2m│ [0mrender =
handler_ex [91m│[0m
[91m│[0m [2m70 [0m[2m│
[0m[96mprint[0m(render) [91m│[0m
[91m╰──────────────────────────────╯[0m
[1;91mZeroDivisionError: [0mdivision by
zero
------------------------------ Captured log call -------------------------------
ERROR rich:test_logging.py:67 message
Traceback (most recent call last):
File "/<<PKGBUILDDIR>>/tests/test_logging.py", line 65, in
test_exception_with_extra_lines
1 / 0
ZeroDivisionError: division by zero
_______________________________ test_expand_bar ________________________________
def test_expand_bar() -> None:
console = Console(
file=io.StringIO(),
force_terminal=True,
width=10,
color_system="truecolor",
legacy_windows=False,
)
progress = Progress(
BarColumn(bar_width=None),
console=console,
get_time=lambda: 1.0,
auto_refresh=False,
)
progress.add_task("foo")
with progress:
pass
expected =
"\x1b[?25l\x1b[38;5;237m━━━━━━━━━━\x1b[0m\r\x1b[2K\x1b[38;5;237m━━━━━━━━━━\x1b[0m\n\x1b[?25h"
render_result = console.file.getvalue()
print("RESULT\n", repr(render_result))
print("EXPECTED\n", repr(expected))
> assert render_result == expected
E AssertionError: assert '\x1b[38;5;23...━━━━\x1b[0m\n' ==
'\x1b[?25l\x1...0m\n\x1b[?25h'
E +
[38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m
E - [?25l[38;5;237m━━━━━━━━━━[0m
E - [2K[38;5;237m━━━━━━━━━━[0m
E - [?25h
tests/test_progress.py:193: AssertionError
----------------------------- Captured stdout call -----------------------------
RESULT
'\x1b[38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m\n'
EXPECTED
'\x1b[?25l\x1b[38;5;237m━━━━━━━━━━\x1b[0m\r\x1b[2K\x1b[38;5;237m━━━━━━━━━━\x1b[0m\n\x1b[?25h'
_________________________________ test_render __________________________________
def test_render() -> None:
expected = "\x1b[?25lfoo
\x1b[38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m \x1b[35m
0%\x1b[0m \x1b[36m-:--:--\x1b[0m\nbar
\x1b[38;2;249;38;114m━━━━━━━━━━━━━━━━━━━━━\x1b[0m\x1b[38;5;237m╺\x1b[0m\x1b[38;5;237m━━━━━━━━━━━━━━━━━━\x1b[0m
\x1b[35m 53%\x1b[0m \x1b[36m-:--:--\x1b[0m\nfoo2
\x1b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m
\x1b[35m100%\x1b[0m
\x1b[36m0:00:00\x1b[0m\r\x1b[2K\x1b[1A\x1b[2K\x1b[1A\x1b[2Kfoo
\x1b[38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m \x1b[35m
0%\x1b[0m \x1b[36m-:--:--\x1b[0m\nbar
\x1b[38;2;249;38;114m━━━━━━━━━━━━━━━━━━━━━\x1b[0m\x1b[38;5;237m╺\x1b[0m\x1b[38;5;237m━━━━━━━━━━━━━━━━━━\x1b[0m
\x1b[35m 53%\x1b[0m \x1b[36m-:--:--\x1b[0m\nfoo2
\x1b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m
\x1b[35m100%\x1b[0m \x1b[36m0:00:00\x1b[0m\n\x1b[?25h"
render_result = render_progress()
print(repr(render_result))
> assert render_result == expected
E AssertionError: assert 'foo \x1b[38...0:00\x1b[0m\n' ==
'\x1b[?25lfoo...0m\n\x1b[?25h'
E - [?25lfoo [38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m
[35m 0%[0m [36m-:--:--[0m
E ? ------
E + foo [38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m [35m
0%[0m [36m-:--:--[0m
E - bar
[38;2;249;38;114m━━━━━━━━━━━━━━━━━━━━━[0m[38;5;237m╺[0m[38;5;237m━━━━━━━━━━━━━━━━━━[0m
[35m 53%[0m [36m-:--:--[0m
E - foo2 [38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m
[35m100%[0m [36m0:00:00[0m
E - [2K[1A[2K[1A[2Kfoo
[38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m [35m 0%[0m
[36m-:--:--[0m
E bar [38;2;249;38;114m━━━━━━━...
E
E ...Full output truncated (3 lines hidden), use '-vv' to show
tests/test_progress.py:200: AssertionError
----------------------------- Captured stdout call -----------------------------
'foo \x1b[38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m \x1b[35m
0%\x1b[0m \x1b[36m-:--:--\x1b[0m\nbar
\x1b[38;2;249;38;114m━━━━━━━━━━━━━━━━━━━━━\x1b[0m\x1b[38;5;237m╺\x1b[0m\x1b[38;5;237m━━━━━━━━━━━━━━━━━━\x1b[0m
\x1b[35m 53%\x1b[0m \x1b[36m-:--:--\x1b[0m\nfoo2
\x1b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m
\x1b[35m100%\x1b[0m \x1b[36m0:00:00\x1b[0m\n'
__________________________________ test_track __________________________________
def test_track() -> None:
console = Console(
file=io.StringIO(),
force_terminal=True,
width=60,
color_system="truecolor",
legacy_windows=False,
)
test = ["foo", "bar", "baz"]
expected_values = iter(test)
for value in track(
test, "test", console=console, auto_refresh=False,
get_time=MockClock(auto=True)
):
assert value == next(expected_values)
result = console.file.getvalue()
print(repr(result))
expected = "\x1b[?25l\r\x1b[2Ktest
\x1b[38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m \x1b[35m
0%\x1b[0m \x1b[36m-:--:--\x1b[0m\r\x1b[2Ktest
\x1b[38;2;249;38;114m━━━━━━━━━━━━━\x1b[0m\x1b[38;5;237m╺\x1b[0m\x1b[38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m
\x1b[35m 33%\x1b[0m \x1b[36m-:--:--\x1b[0m\r\x1b[2Ktest
\x1b[38;2;249;38;114m━━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m\x1b[38;2;249;38;114m╸\x1b[0m\x1b[38;5;237m━━━━━━━━━━━━━\x1b[0m
\x1b[35m 67%\x1b[0m \x1b[36m0:00:06\x1b[0m\r\x1b[2Ktest
\x1b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m
\x1b[35m100%\x1b[0m \x1b[36m0:00:00\x1b[0m\r\x1b[2Ktest
\x1b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m
\x1b[35m100%\x1b[0m \x1b[36m0:00:00\x1b[0m\n\x1b[?25h"
print("--")
print("RESULT:")
print(result)
print(repr(result))
print("EXPECTED:")
print(expected)
print(repr(expected))
> assert result == expected
E AssertionError: assert 'test \x1b[38...0:00\x1b[0m\n' ==
'\x1b[?25l\r\...0m\n\x1b[?25h'
E - [?25l
E - [2Ktest [38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m
[35m 0%[0m [36m-:--:--[0m
E - [2Ktest
[38;2;249;38;114m━━━━━━━━━━━━━[0m[38;5;237m╺[0m[38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━━[0m
[35m 33%[0m [36m-:--:--[0m
E - [2Ktest
[38;2;249;38;114m━━━━━━━━━━━━━━━━━━━━━━━━━━[0m[38;2;249;38;114m╸[0m[38;5;237m━━━━━━━━━━━━━[0m
[35m 67%[0m [36m0:00:06[0m
E - [2Ktest
[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m [35m100%[0m
[36m0:00:00[0m
E - [2Ktest
[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m [35m100%[0m...
E
E ...Full output truncated (4 lines hidden), use '-vv' to show
tests/test_progress.py:229: AssertionError
----------------------------- Captured stdout call -----------------------------
'test \x1b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m
\x1b[35m100%\x1b[0m \x1b[36m0:00:00\x1b[0m\n'
--
RESULT:
test [38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m
[35m100%[0m [36m0:00:00[0m
'test \x1b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m
\x1b[35m100%\x1b[0m \x1b[36m0:00:00\x1b[0m\n'
EXPECTED:
[?25l
[2Ktest [38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m [35m 0%[0m
[36m-:--:--[0m
[2Ktest
[38;2;249;38;114m━━━━━━━━━━━━━[0m[38;5;237m╺[0m[38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━━[0m
[35m 33%[0m [36m-:--:--[0m
[2Ktest
[38;2;249;38;114m━━━━━━━━━━━━━━━━━━━━━━━━━━[0m[38;2;249;38;114m╸[0m[38;5;237m━━━━━━━━━━━━━[0m
[35m 67%[0m [36m0:00:06[0m
[2Ktest [38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m
[35m100%[0m [36m0:00:00[0m
[2Ktest [38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m
[35m100%[0m [36m0:00:00[0m
[?25h
'\x1b[?25l\r\x1b[2Ktest
\x1b[38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m \x1b[35m
0%\x1b[0m \x1b[36m-:--:--\x1b[0m\r\x1b[2Ktest
\x1b[38;2;249;38;114m━━━━━━━━━━━━━\x1b[0m\x1b[38;5;237m╺\x1b[0m\x1b[38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m
\x1b[35m 33%\x1b[0m \x1b[36m-:--:--\x1b[0m\r\x1b[2Ktest
\x1b[38;2;249;38;114m━━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m\x1b[38;2;249;38;114m╸\x1b[0m\x1b[38;5;237m━━━━━━━━━━━━━\x1b[0m
\x1b[35m 67%\x1b[0m \x1b[36m0:00:06\x1b[0m\r\x1b[2Ktest
\x1b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m
\x1b[35m100%\x1b[0m \x1b[36m0:00:00\x1b[0m\r\x1b[2Ktest
\x1b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m
\x1b[35m100%\x1b[0m \x1b[36m0:00:00\x1b[0m\n\x1b[?25h'
_____________________________ test_progress_track ______________________________
def test_progress_track() -> None:
console = Console(
file=io.StringIO(),
force_terminal=True,
width=60,
color_system="truecolor",
legacy_windows=False,
)
progress = Progress(
console=console, auto_refresh=False, get_time=MockClock(auto=True)
)
test = ["foo", "bar", "baz"]
expected_values = iter(test)
with progress:
for value in progress.track(test, description="test"):
assert value == next(expected_values)
result = console.file.getvalue()
print(repr(result))
expected = "\x1b[?25l\r\x1b[2Ktest
\x1b[38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m \x1b[35m
0%\x1b[0m \x1b[36m-:--:--\x1b[0m\r\x1b[2Ktest
\x1b[38;2;249;38;114m━━━━━━━━━━━━━\x1b[0m\x1b[38;5;237m╺\x1b[0m\x1b[38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m
\x1b[35m 33%\x1b[0m \x1b[36m-:--:--\x1b[0m\r\x1b[2Ktest
\x1b[38;2;249;38;114m━━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m\x1b[38;2;249;38;114m╸\x1b[0m\x1b[38;5;237m━━━━━━━━━━━━━\x1b[0m
\x1b[35m 67%\x1b[0m \x1b[36m0:00:06\x1b[0m\r\x1b[2Ktest
\x1b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m
\x1b[35m100%\x1b[0m \x1b[36m0:00:00\x1b[0m\r\x1b[2Ktest
\x1b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m
\x1b[35m100%\x1b[0m \x1b[36m0:00:00\x1b[0m\n\x1b[?25h"
print(expected)
print(repr(expected))
print(result)
print(repr(result))
> assert result == expected
E AssertionError: assert 'test \x1b[38...0:00\x1b[0m\n' ==
'\x1b[?25l\r\...0m\n\x1b[?25h'
E - [?25l
E - [2Ktest [38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m
[35m 0%[0m [36m-:--:--[0m
E - [2Ktest
[38;2;249;38;114m━━━━━━━━━━━━━[0m[38;5;237m╺[0m[38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━━[0m
[35m 33%[0m [36m-:--:--[0m
E - [2Ktest
[38;2;249;38;114m━━━━━━━━━━━━━━━━━━━━━━━━━━[0m[38;2;249;38;114m╸[0m[38;5;237m━━━━━━━━━━━━━[0m
[35m 67%[0m [36m0:00:06[0m
E - [2Ktest
[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m [35m100%[0m
[36m0:00:00[0m
E - [2Ktest
[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m [35m100%[0m...
E
E ...Full output truncated (4 lines hidden), use '-vv' to show
tests/test_progress.py:261: AssertionError
----------------------------- Captured stdout call -----------------------------
'test \x1b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m
\x1b[35m100%\x1b[0m \x1b[36m0:00:00\x1b[0m\n'
[?25l
[2Ktest [38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m [35m 0%[0m
[36m-:--:--[0m
[2Ktest
[38;2;249;38;114m━━━━━━━━━━━━━[0m[38;5;237m╺[0m[38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━━[0m
[35m 33%[0m [36m-:--:--[0m
[2Ktest
[38;2;249;38;114m━━━━━━━━━━━━━━━━━━━━━━━━━━[0m[38;2;249;38;114m╸[0m[38;5;237m━━━━━━━━━━━━━[0m
[35m 67%[0m [36m0:00:06[0m
[2Ktest [38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m
[35m100%[0m [36m0:00:00[0m
[2Ktest [38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m
[35m100%[0m [36m0:00:00[0m
[?25h
'\x1b[?25l\r\x1b[2Ktest
\x1b[38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m \x1b[35m
0%\x1b[0m \x1b[36m-:--:--\x1b[0m\r\x1b[2Ktest
\x1b[38;2;249;38;114m━━━━━━━━━━━━━\x1b[0m\x1b[38;5;237m╺\x1b[0m\x1b[38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m
\x1b[35m 33%\x1b[0m \x1b[36m-:--:--\x1b[0m\r\x1b[2Ktest
\x1b[38;2;249;38;114m━━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m\x1b[38;2;249;38;114m╸\x1b[0m\x1b[38;5;237m━━━━━━━━━━━━━\x1b[0m
\x1b[35m 67%\x1b[0m \x1b[36m0:00:06\x1b[0m\r\x1b[2Ktest
\x1b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m
\x1b[35m100%\x1b[0m \x1b[36m0:00:00\x1b[0m\r\x1b[2Ktest
\x1b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m
\x1b[35m100%\x1b[0m \x1b[36m0:00:00\x1b[0m\n\x1b[?25h'
test [38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[0m
[35m100%[0m [36m0:00:00[0m
'test \x1b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m
\x1b[35m100%\x1b[0m \x1b[36m0:00:00\x1b[0m\n'
_________________________________ test_columns _________________________________
def test_columns() -> None:
console = Console(
file=io.StringIO(),
force_terminal=True,
width=80,
log_time_format="[TIME]",
color_system="truecolor",
legacy_windows=False,
log_path=False,
)
progress = Progress(
"test",
TextColumn("{task.description}"),
BarColumn(bar_width=None),
TimeRemainingColumn(),
TimeElapsedColumn(),
FileSizeColumn(),
TotalFileSizeColumn(),
DownloadColumn(),
TransferSpeedColumn(),
transient=True,
console=console,
auto_refresh=False,
get_time=MockClock(),
)
task1 = progress.add_task("foo", total=10)
task2 = progress.add_task("bar", total=7)
with progress:
for n in range(4):
progress.advance(task1, 3)
progress.advance(task2, 4)
print("foo")
console.log("hello")
console.print("world")
progress.refresh()
from .render import replace_link_ids
result = replace_link_ids(console.file.getvalue())
print(repr(result))
expected = "\x1b[?25ltest foo
\x1b[38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m \x1b[36m-:--:--\x1b[0m
\x1b[33m0:00:37\x1b[0m \x1b[32m0 bytes\x1b[0m \x1b[32m10 bytes\x1b[0m
\x1b[32m0/10 bytes\x1b[0m \x1b[31m?\x1b[0m\ntest bar
\x1b[38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m \x1b[36m-:--:--\x1b[0m
\x1b[33m0:00:36\x1b[0m \x1b[32m0 bytes\x1b[0m \x1b[32m7 bytes \x1b[0m
\x1b[32m0/7 bytes \x1b[0m \x1b[31m?\x1b[0m\r\x1b[2K\x1b[1A\x1b[2Kfoo\ntest foo
\x1b[38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m \x1b[36m-:--:--\x1b[0m
\x1b[33m0:00:37\x1b[0m \x1b[32m0 bytes\x1b[0m \x1b[32m10 bytes\x1b[0m
\x1b[32m0/10 bytes\x1b[0m \x1b[31m?\x1b[0m\ntest bar
\x1b[38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m \x1b[36m-:--:--\x1b[0m
\x1b[33m0:00:36\x1b[0m \x1b[32m0 bytes\x1b[0m \x1b[32m7 bytes \x1b[0m
\x1b[32m0/7 bytes \x1b[0m
\x1b[31m?\x1b[0m\r\x1b[2K\x1b[1A\x1b[2K\x1b[2;36m[TIME]\x1b[0m\x1b[2;36m
\x1b[0mhello
\ntest foo \x1b[38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m
\x1b[36m-:--:--\x1b[0m \x1b[33m0:00:37\x1b[0m \x1b[32m0 bytes\x1b[0m \x1b[32m10
bytes\x1b[0m \x1b[32m0/10 bytes\x1b[0m \x1b[31m?\x1b[0m\ntest bar
\x1b[38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m \x1b[36m-:--:--\x1b[0m
\x1b[33m0:00:36\x1b[0m \x1b[32m0 bytes\x1b[0m \x1b[32m7 bytes \x1b[0m
\x1b[32m0/7 bytes \x1b[0m \x1b[31m?\x1b[0m\r\x1b[2K\x1b[1A\x1b[2Kworld\ntest
foo \x1b[38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m \x1b[36m-:--:--\x1b[0m
\x1b[33m0:00:37\x1b[0m \x1b[32m0 bytes\x1b[0m \x1b[32m10 bytes\x1b[0m
\x1b[32m0/10 bytes\x1b[0m \x1b[31m?\x1b[0m\ntest bar
\x1b[38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━\x1b[0m \x1b[36m-:--:--\x1b[0m
\x1b[33m0:00:36\x1b[0m \x1b[32m0 bytes\x1b[0m \x1b[32m7 bytes \x1b[0m
\x1b[32m0/7 bytes \x1b[0m \x1b[31m?\x1b[0m\r\x1b[2K\x1b[1A\x1b[2Ktest foo
\x1b[38;2;114;156;31m━━━━━━━━━━━━━━━━\x1b[0m \x1b[36m0:00:00\x1b[0m
\x1b[33m0:01:00\x1b[0m \x1b[32m12 bytes\x1b[0m \x1b[32m10 bytes\x1b[0m
\x1b[32m12/10 bytes\x1b[0m \x1b[31m1 byte/s\x1b[0m\ntest bar
\x1b[38;2;114;156;31m━━━━━━━━━━━━━━━━\x1b[0m \x1b[36m0:00:00\x1b[0m
\x1b[33m0:00:45\x1b[0m \x1b[32m16 bytes\x1b[0m \x1b[32m7 bytes \x1b[0m
\x1b[32m16/7 bytes \x1b[0m \x1b[31m1 byte/s\x1b[0m\r\x1b[2K\x1b[1A\x1b[2Ktest
foo \x1b[38;2;114;156;31m━━━━━━━━━━━━━━━━\x1b[0m \x1b[36m0:00:00\x1b[0m
\x1b[33m0:01:00\x1b[0m \x1b[32m12 bytes\x1b[0m \x1b[32m10 bytes\x1b[0m
\x1b[32m12/10 bytes\x1b[0m \x1b[31m1 byte/s\x1b[0m\ntest bar
\x1b[38;2;114;156;31m━━━━━━━━━━━━━━━━\x1b[0m \x1b[36m0:00:00\x1b[0m
\x1b[33m0:00:45\x1b[0m \x1b[32m16 bytes\x1b[0m \x1b[32m7 bytes \x1b[0m
\x1b[32m16/7 bytes \x1b[0m \x1b[31m1
byte/s\x1b[0m\n\x1b[?25h\r\x1b[1A\x1b[2K\x1b[1A\x1b[2K"
> assert result == expected
E AssertionError: assert 'foo\n\x1b[2;... \nworld\n\n' ==
'\x1b[?25ltes...x1b[1A\x1b[2K'
E + foo
E - [?25ltest foo [38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━[0m
[36m-:--:--[0m [33m0:00:37[0m [32m0 bytes[0m [32m10 bytes[0m [32m0/10
bytes[0m [31m?[0m
E - test bar [38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━[0m [36m-:--:--[0m
[33m0:00:36[0m [32m0 bytes[0m [32m7 bytes [0m [32m0/7 bytes [0m
[31m?[0m
E - [2K[1A[2Kfoo
E - test foo [38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━[0m [36m-:--:--[0m
[33m0:00:37[0m [32m0 bytes[0m [32m10 bytes[0m [32m0/10 bytes[0m
[31m?[0m
E - test bar [38;5;237m━━━━━━━━━━━━━━━━━━━━━━━━━[0m [36m-:--:--[0m
[33m0:00:36[0m [32m0 b...
E
E ...Full output truncated (17 lines hidden), use '-vv' to show
tests/test_progress.py:309: AssertionError
----------------------------- Captured stdout call -----------------------------
'foo\n\x1b[2;36m[TIME]\x1b[0m\x1b[2;36m \x1b[0mhello
\nworld\n\n'
__________________________ test_progress_max_refresh ___________________________
def test_progress_max_refresh() -> None:
"""Test max_refresh argment."""
time = 0.0
def get_time() -> float:
nonlocal time
try:
return time
finally:
time = time + 1.0
console = Console(
color_system=None, width=80, legacy_windows=False,
force_terminal=True
)
column = TextColumn("{task.description}")
column.max_refresh = 3
progress = Progress(
column,
get_time=get_time,
auto_refresh=False,
console=console,
)
console.begin_capture()
with progress:
task_id = progress.add_task("start")
for tick in range(6):
progress.update(task_id, description=f"tick {tick}")
progress.refresh()
result = console.end_capture()
print(repr(result))
> assert (
result
== "\x1b[?25l\r\x1b[2Kstart\r\x1b[2Kstart\r\x1b[2Ktick
1\r\x1b[2Ktick 1\r\x1b[2Ktick 3\r\x1b[2Ktick 3\r\x1b[2Ktick 5\r\x1b[2Ktick
5\n\x1b[?25h"
)
E AssertionError: assert 'tick 5\n' == '\x1b[?25l\r\... 5\n\x1b[?25h'
E - [?25l
E - [2Kstart
E - [2Kstart
E - [2Ktick 1
E - [2Ktick 1
E - [2Ktick 3
E - [2Ktick 3
...
E
E ...Full output truncated (6 lines hidden), use '-vv' to show
tests/test_progress.py:421: AssertionError
----------------------------- Captured stdout call -----------------------------
'tick 5\n'
__________________________________ test_rule ___________________________________
def test_rule():
console = Console(
width=16, file=io.StringIO(), force_terminal=True,
legacy_windows=False
)
console.print(Rule())
console.print(Rule("foo"))
console.rule(Text("foo", style="bold"))
console.rule("foobarbazeggfoobarbazegg")
expected = "\x1b[92m────────────────\x1b[0m\n"
expected += "\x1b[92m───── \x1b[0mfoo\x1b[92m ──────\x1b[0m\n"
expected += "\x1b[92m───── \x1b[0m\x1b[1mfoo\x1b[0m\x1b[92m
──────\x1b[0m\n"
expected += "\x1b[92m─ \x1b[0mfoobarbazeg…\x1b[92m ─\x1b[0m\n"
result = console.file.getvalue()
> assert result == expected
E AssertionError: assert '────────────...───────────\n' ==
'\x1b[92m────...2m ─\x1b[0m\n'
E - [92m────────────────[0m
E - [92m───── [0mfoo[92m ──────[0m
E - [92m───── [0m[1mfoo[0m[92m ──────[0m
E - [92m─ [0mfoobarbazeg…[92m ─[0m
E +
────────────────────────────────────────────────────────────────────────────────
E + ───────────────────────────────────── foo
──────────────────────────────────────
E + ───────────────────────────────────── foo
──────────────────────────────────────...
E
E ...Full output truncated (2 lines hidden), use '-vv' to show
tests/test_rule.py:24: AssertionError
________________________________ test_rule_cjk _________________________________
def test_rule_cjk():
console = Console(
width=16,
file=io.StringIO(),
force_terminal=True,
color_system=None,
legacy_windows=False,
)
console.rule("欢迎!")
expected = "──── 欢迎! ────\n"
> assert console.file.getvalue() == expected
E AssertionError: assert '────────────...───────────\n' == '──── 欢迎!
────\n'
E - ──── 欢迎! ────
E + ──────────────────────────────────── 欢迎!
────────────────────────────────────
tests/test_rule.py:56: AssertionError
_______________________________ test_characters ________________________________
def test_characters():
console = Console(
width=16,
file=io.StringIO(),
force_terminal=True,
color_system=None,
legacy_windows=False,
)
console.rule(characters="+*")
console.rule("foo", characters="+*")
console.print(Rule(characters=".,"))
expected = "+*+*+*+*+*+*+*+*\n"
expected += "+*+*+ foo +*+*+*\n"
expected += ".,.,.,.,.,.,.,.,\n"
> assert console.file.getvalue() == expected
E AssertionError: assert '+*+*+*+*+*+*...,.,.,.,.,.,\n' ==
'+*+*+*+*+*+*...,.,.,.,.,.,\n'
E - +*+*+*+*+*+*+*+*
E - +*+*+ foo +*+*+*
E - .,.,.,.,.,.,.,.,
E +
+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*
E + +*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+ foo
+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*
E +
.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,
tests/test_rule.py:73: AssertionError
_________________________________ test_styled __________________________________
def test_styled():
styled_foo = Styled("foo", "on red")
console = Console(file=io.StringIO(), force_terminal=True)
assert Measurement.get(console, styled_foo, 80) == Measurement(3, 3)
console.print(styled_foo)
result = console.file.getvalue()
expected = "\x1b[41mfoo\x1b[0m\n"
> assert result == expected
E AssertionError: assert 'foo\n' == '\x1b[41mfoo\x1b[0m\n'
E - [41mfoo[0m
E + foo
tests/test_styled.py:15: AssertionError
______________________________ test_render_table _______________________________
def test_render_table():
expected = " test table \n┏━━━━━━┳━┳━┓\n┃ foo ┃ ┃ ┃\n┡━━━━━━╇━╇━┩\n│
Ave… │ │ │\n└──────┴─┴─┘\n table \n caption \n test table
\n┏━━━━━━━━━━━┳━┳━┓\n┃ foo ┃ ┃ ┃\n┡━━━━━━━━━━━╇━╇━┩\n│ Averlong… │ │
│\n└───────────┴─┴─┘\n table caption \n test table
\n┏━━━━━━━━━━━━━━━━┳━┳━┓\n┃ foo ┃ ┃ ┃\n┡━━━━━━━━━━━━━━━━╇━╇━┩\n│
Averlongwordg… │ │ │\n└────────────────┴─┴─┘\n table caption \n
test table \n┏━━━━━━━━━━━━━━━━━━━━━┳━┳━┓\n┃ foo ┃ ┃
┃\n┡━━━━━━━━━━━━━━━━━━━━━╇━╇━┩\n│ Averlongwordgoeshe… │ │
│\n└─────────────────────┴─┴─┘\n table caption \n test
table \n┏━━━━━━━━━━━━━━━━━━━━━━┳━━┳━━┓\n┃ foo ┃ ┃
┃\n┡━━━━━━━━━━━━━━━━━━━━━━╇━━╇━━┩\n│ Averlongwordgoeshere │ │
│\n└──────────────────────┴──┴──┘\n table caption \n
test table \n┏━━━━━━━━━━━━━━━━━━━━━━┳━━━━━┳━━━━┓\n┃ foo
┃ bar ┃ b… ┃\n┡━━━━━━━━━━━━━━━━━━━━━━╇━━━━━╇━━━━┩\n│ Averlongwordgoeshere
│ ba… │ │\n│ │ pa… │
│\n└──────────────────────┴─────┴────┘\n table caption \n
test table
\n┏━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━┓\n┃ foo ┃ bar ┃
baz ┃\n┡━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━┩\n│ Averlongwordgoeshere │
banana │ │\n│ │ pancak… │
│\n└──────────────────────┴─────────┴─────┘\n table caption
\n test table
\n┏━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━┓\n┃ foo ┃
bar ┃ baz ┃\n┡━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━┩\n│
Averlongwordgoeshere │ banana │ │\n│ │
pancakes │ │\n└──────────────────────┴──────────────┴─────┘\n
table caption \n test table
\n┏━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┳━━━━━┓\n┃ foo
┃ bar ┃ baz
┃\n┡━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━╇━━━━━┩\n│ Averlongwordgoeshere
│ banana pancakes │
│\n└───────────────────────┴──────────────────┴─────┘\n table
caption \n test table
\n┏━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┳━━━━━┓\n┃ foo
┃ bar ┃ baz
┃\n┡━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━╇━━━━━┩\n│
Averlongwordgoeshere │ banana pancakes │
│\n└──────────────────────────┴────────────────────┴─────┘\n
table caption \n test table
\n┏━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━┓
\n┃ foo ┃ bar ┃ baz ┃
\n┡━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━┩ \n│
Averlongwordgoeshere │ banana pancakes │ │
\n└──────────────────────┴─────────────────┴─────┘ \n
table caption \n test
table \n
┏━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━┓ \n ┃ foo
┃ bar ┃ baz ┃ \n
┡━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━┩ \n │
Averlongwordgoeshere │ banana pancakes │ │ \n
└──────────────────────┴─────────────────┴─────┘ \n
table caption \n test
table \n
┏━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━┓\n ┃ foo
┃ bar ┃ baz ┃\n
┡━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━┩\n │
Averlongwordgoeshere │ banana pancakes │ │\n
└──────────────────────┴─────────────────┴─────┘\n
table caption \n test table
\n┏━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━┳━━━━━━━━━━┓\n┃
foo ┃ bar ┃ baz ┃
┃\n┡━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━╇━━━━━━━━━━┩\n│
Averlongwordgoeshere │ banana pancakes │ │ │\n│ Coffee
│ │ │ │\n│ Coffee │ Chocolate
│ │ cinnamon
│\n└──────────────────────┴─────────────────┴─────┴──────────┘\n
table caption \n test table
\n┏━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━┳━━━━━━━━━━┓\n┃ foo
┃ bar ┃ baz ┃
┃\n┡━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━╇━━━━━━━━━━┩\n│
Averlongwordgoeshere │ banana pancakes │ │
│\n├──────────────────────┼─────────────────┼─────┼──────────┤\n│ Coffee
│ │ │
│\n├──────────────────────┼─────────────────┼─────┼──────────┤\n│ Coffee
│ Chocolate │ │ cinnamon
│\n└──────────────────────┴─────────────────┴─────┴──────────┘\n
table caption \n test table
\n┏━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━┳━━━━━━━━━━┓\n┃ foo
┃ bar ┃ baz ┃
┃\n┡━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━╇━━━━━━━━━━┩\n│
Averlongwordgoeshere │ banana pancakes │ │
│\n├──────────────────────┼─────────────────┼─────┼──────────┤\n│ Coffee
│ │ │
│\n├──────────────────────┼─────────────────┼─────┼──────────┤\n│ Coffee
│ Chocolate │ │ cinnamon
│\n├──────────────────────┼─────────────────┼─────┼──────────┤\n│ total
│ │ │
│\n└──────────────────────┴─────────────────┴─────┴──────────┘\n
table caption \n test table
\n foo ┃ bar ┃ baz ┃
\n━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━╇━━━━━━━━━━\n
Averlongwordgoeshere │ banana pancakes │ │
\n──────────────────────┼─────────────────┼─────┼──────────\n Coffee
│ │ │
\n──────────────────────┼─────────────────┼─────┼──────────\n Coffee
│ Chocolate │ │ cinnamon
\n──────────────────────┼─────────────────┼─────┼──────────\n total
│ │ │ \n table caption
\n test table \n
┃ ┃ ┃ \n foo
┃ bar ┃ baz ┃ \n ┃ ┃
┃ \n━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━╇━━━━━━━━━━\n
│ │ │ \n Averlongwordgoeshere │
banana pancakes │ │ \n │ │
│ \n──────────────────────┼─────────────────┼─────┼──────────\n
│ │ │ \n Coffee │
│ │ \n │ │ │
\n──────────────────────┼─────────────────┼─────┼──────────\n
│ │ │ \n Coffee │
Chocolate │ │ cinnamon \n │ │ │
\n──────────────────────┼─────────────────┼─────┼──────────\n
│ │ │ \n total │
│ │ \n │ │ │
\n table caption \n test
table \n ┃ ┃ ┃ \n foo ┃ ┃ ┃ \n
┃ ┃ ┃ \n━━━━━━━━━━━━━━━━━╇━╇━╇━\n │ │ │ \n Averlongwordgo… │ │
│ \n │ │ │ \n─────────────────┼─┼─┼─\n │ │ │ \n
Coffee │ │ │ \n │ │ │ \n─────────────────┼─┼─┼─\n
│ │ │ \n Coffee │ │ │ \n │ │ │
\n─────────────────┼─┼─┼─\n │ │ │ \n total │ │ │ \n
│ │ │ \n table caption \n test table \n
┃ ┃ ┃ \n foo ┃ bar ┃ ┃ \n ┃ ┃ ┃
\n━━━━━━━━━━╇━━━━━━━━━╇━╇━\n │ │ │ \n Averlon… │ banana… │ │
\n │ │ │ \n──────────┼─────────┼─┼─\n │ │ │
\n Coffee │ │ │ \n │ │ │
\n──────────┼─────────┼─┼─\n │ │ │ \n Coffee │ Chocol… │ │
\n │ │ │ \n──────────┼─────────┼─┼─\n │ │ │
\n total │ │ │ \n │ │ │ \n table caption
\n test table \nfoo
┃ bar ┃ baz┃
\n━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━╇━━━━━━━━━\nAverlongwordgoeshere
│ banana pancakes │ │ \n │
│ │ \nCoffee │ │ │
\n │ │ │ \nCoffee
│ Chocolate │ │cinnamon
\n─────────────────────────┼───────────────────┼────┼─────────\ntotal
│ │ │ \n table
caption \n"
> assert render_tables() == expected
E AssertionError: assert ' test table ... \n' == ' test table
... \n'
E Skipping 2587 identical leading characters in diff, use -v to show
E -
E +
E - ┏━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━┓
E + ┏━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━┓
E ?
++++++++++++++++++++
E - ┃ foo ┃ bar ┃ baz ┃ ...
E
E ...Full output truncated (175 lines hidden), use '-vv' to show
tests/test_table.py:84: AssertionError
=========================== short test summary info ============================
FAILED tests/test_align.py::test_align_right_style - AssertionError: assert '...
FAILED tests/test_console.py::test_dumb_terminal - assert None is not None
FAILED tests/test_console.py::test_show_cursor - AssertionError: assert 'foo\...
FAILED tests/test_console.py::test_clear - AssertionError: assert '' == '\x1b...
FAILED tests/test_console.py::test_control - AssertionError: assert 'BAR\n' =...
FAILED tests/test_console.py::test_justify_left - AssertionError: assert 'FOO...
FAILED tests/test_console.py::test_justify_center - AssertionError: assert ' ...
FAILED tests/test_console.py::test_justify_right - AssertionError: assert ' ...
FAILED tests/test_console.py::test_justify_renderable_left - AssertionError: ...
FAILED tests/test_console.py::test_justify_renderable_center - AssertionError...
FAILED tests/test_console.py::test_justify_renderable_right - AssertionError:...
FAILED tests/test_console.py::test_bell - AssertionError: assert '' == '\x07'
FAILED tests/test_console.py::test_screen - assert "Don't panic\n" == '\x1b[?...
FAILED tests/test_console.py::test_screen_update - AssertionError: assert '\x...
FAILED tests/test_live.py::test_growing_display - AssertionError: assert 'Ste...
FAILED tests/test_live.py::test_growing_display_transient - AssertionError: a...
FAILED tests/test_live.py::test_growing_display_overflow_ellipsis - Assertion...
FAILED tests/test_live.py::test_growing_display_overflow_crop - AssertionErro...
FAILED tests/test_live.py::test_growing_display_overflow_visible - AssertionE...
FAILED tests/test_live.py::test_growing_display_console_redirect - AssertionE...
FAILED tests/test_live.py::test_live_screen - AssertionError: assert '' == '\...
FAILED tests/test_logging.py::test_exception - AssertionError: assert 'divisi...
FAILED tests/test_logging.py::test_exception_with_extra_lines - AssertionErro...
FAILED tests/test_progress.py::test_expand_bar - AssertionError: assert '\x1b...
FAILED tests/test_progress.py::test_render - AssertionError: assert 'foo \x1...
FAILED tests/test_progress.py::test_track - AssertionError: assert 'test \x1b...
FAILED tests/test_progress.py::test_progress_track - AssertionError: assert '...
FAILED tests/test_progress.py::test_columns - AssertionError: assert 'foo\n\x...
FAILED tests/test_progress.py::test_progress_max_refresh - AssertionError: as...
FAILED tests/test_rule.py::test_rule - AssertionError: assert '────────────.....
FAILED tests/test_rule.py::test_rule_cjk - AssertionError: assert '──────────...
FAILED tests/test_rule.py::test_characters - AssertionError: assert '+*+*+*+*...
FAILED tests/test_styled.py::test_styled - AssertionError: assert 'foo\n' == ...
FAILED tests/test_table.py::test_render_table - AssertionError: assert ' test...
================== 34 failed, 429 passed, 1 skipped in 6.05s ===================
E: pybuild pybuild:353: test: plugin custom failed with: exit code=1:
PYTHONPATH=/<<PKGBUILDDIR>> python3.9 -m pytest
dh_auto_test: error: pybuild --test --test-pytest -i python{version} -p 3.9
returned exit code 13
make[1]: *** [debian/rules:12: override_dh_auto_test] Error 25
make[1]: Leaving directory '/<<PKGBUILDDIR>>'
make: *** [debian/rules:6: build] Error 2
dpkg-buildpackage: error: debian/rules build subprocess returned exit status 2
--- End Message ---