diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2020-02-17 14:25:32 -0500 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2020-02-17 14:25:32 -0500 |
commit | e1dc7637ab99bedaafa421b7fd499ed6302008f1 (patch) | |
tree | f168cec42dd44b7e5d80b2d301fbb5e9da2560a8 | |
parent | d80b27f8e259ffe3b14cef88e8ed9cde350ba397 (diff) | |
download | cmd2-git-e1dc7637ab99bedaafa421b7fd499ed6302008f1.tar.gz |
Updated unit test
-rw-r--r-- | cmd2/cmd2.py | 1 | ||||
-rw-r--r-- | tests/test_argparse_completer.py | 7 |
2 files changed, 6 insertions, 2 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index f4e1ef8d..49273b51 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -1419,6 +1419,7 @@ class Cmd(cmd.Cmd): except CompletionError as e: err_str = str(e) if err_str: + # Don't print error and redraw the prompt unless the error has length ansi.style_aware_write(sys.stdout, err_str + '\n') rl_force_redisplay() return None diff --git a/tests/test_argparse_completer.py b/tests/test_argparse_completer.py index c0cb8b4a..2619d053 100644 --- a/tests/test_argparse_completer.py +++ b/tests/test_argparse_completer.py @@ -699,7 +699,7 @@ def test_completion_items_default_header(ac_app): ('hint', '', True), ('hint --flag', '', True), ('hint --suppressed_help', '', False), - ('hint --suppressed_hint', '--', False), + ('hint --suppressed_hint', '', False), # Hint because flag does not have enough values to be considered finished ('nargs --one_or_more', '-', True), @@ -730,7 +730,10 @@ def test_autocomp_hint(ac_app, command_and_args, text, has_hint, capsys): complete_tester(text, line, begidx, endidx, ac_app) out, err = capsys.readouterr() - assert has_hint == ("Hint:\n" in out) + if has_hint: + assert "Hint:\n" in out + else: + assert not out def test_autocomp_hint_no_help_text(ac_app, capsys): |