From 42afcf30aba631f4caf6265eb767000e4134c873 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= Date: Sat, 6 Jun 2026 17:37:00 +0200 Subject: [PATCH] tests: make tests compatible with rich 14.3.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- tests/test_cmd2.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index 79cfd9f27..fd41c8b1e 100644 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -3692,7 +3692,7 @@ def test_ansi_pouterr_always_tty(mocker, capsys) -> None: mocker.patch.object(sys.stderr, "isatty", return_value=True) expected_plain = "oopsie\n" - expected_styled = su.stylize("oopsie\n", Cmd2Style.ERROR) + expected_styled = su.stylize('oopsie', Cmd2Style.ERROR) + '\n' app.onecmd_plus_hooks("echo_error oopsie") out, err = capsys.readouterr() @@ -3712,7 +3712,7 @@ def test_ansi_pouterr_always_notty(mocker, capsys) -> None: mocker.patch.object(sys.stderr, "isatty", return_value=False) expected_plain = "oopsie\n" - expected_styled = su.stylize("oopsie\n", Cmd2Style.ERROR) + expected_styled = su.stylize('oopsie', Cmd2Style.ERROR) + '\n' app.onecmd_plus_hooks("echo_error oopsie") out, err = capsys.readouterr() @@ -3732,7 +3732,7 @@ def test_ansi_terminal_tty(mocker, capsys) -> None: mocker.patch.object(sys.stderr, "isatty", return_value=True) expected_plain = "oopsie\n" - expected_styled = su.stylize("oopsie\n", Cmd2Style.ERROR) + expected_styled = su.stylize('oopsie', Cmd2Style.ERROR) + '\n' app.onecmd_plus_hooks("echo_error oopsie") out, err = capsys.readouterr()