Skip to content

Commit 42afcf3

Browse files
committed
tests: make tests compatible with rich 14.3.3
It seems that with the upgrade to rich 14.3.3 (what we have in openSUSE/Tumbleweed) `stylize` function eats EOLs. I have modified tests to acommodate that, and I hope it should be universal enough so that even with older versions of rich nothing should break. Signed-off-by: Matěj Cepl <mcepl@cepl.eu>
1 parent dc266d8 commit 42afcf3

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

tests/test_cmd2.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3692,7 +3692,7 @@ def test_ansi_pouterr_always_tty(mocker, capsys) -> None:
36923692
mocker.patch.object(sys.stderr, "isatty", return_value=True)
36933693

36943694
expected_plain = "oopsie\n"
3695-
expected_styled = su.stylize("oopsie\n", Cmd2Style.ERROR)
3695+
expected_styled = su.stylize('oopsie', Cmd2Style.ERROR) + '\n'
36963696

36973697
app.onecmd_plus_hooks("echo_error oopsie")
36983698
out, err = capsys.readouterr()
@@ -3712,7 +3712,7 @@ def test_ansi_pouterr_always_notty(mocker, capsys) -> None:
37123712
mocker.patch.object(sys.stderr, "isatty", return_value=False)
37133713

37143714
expected_plain = "oopsie\n"
3715-
expected_styled = su.stylize("oopsie\n", Cmd2Style.ERROR)
3715+
expected_styled = su.stylize('oopsie', Cmd2Style.ERROR) + '\n'
37163716

37173717
app.onecmd_plus_hooks("echo_error oopsie")
37183718
out, err = capsys.readouterr()
@@ -3732,7 +3732,7 @@ def test_ansi_terminal_tty(mocker, capsys) -> None:
37323732
mocker.patch.object(sys.stderr, "isatty", return_value=True)
37333733

37343734
expected_plain = "oopsie\n"
3735-
expected_styled = su.stylize("oopsie\n", Cmd2Style.ERROR)
3735+
expected_styled = su.stylize('oopsie', Cmd2Style.ERROR) + '\n'
37363736

37373737
app.onecmd_plus_hooks("echo_error oopsie")
37383738
out, err = capsys.readouterr()

0 commit comments

Comments
 (0)