Skip to content

Commit

Permalink
Updated unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kmvanbrunt committed Nov 11, 2021
1 parent 39c1e71 commit 28bdb95
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests_isolated/test_commandset/test_commandset.py
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ def do_user_unrelated(self, ns: argparse.Namespace):
self._cmd.poutput('something {}'.format(ns.state))


def test_cross_commandset_completer(command_sets_manual):
def test_cross_commandset_completer(command_sets_manual, capsys):
global complete_states_expected_self
# This tests the different ways to locate the matching CommandSet when completing an argparse argument.
# Exercises the 3 cases in cmd2.Cmd._resolve_func_self().
Expand Down Expand Up @@ -844,9 +844,11 @@ def test_cross_commandset_completer(command_sets_manual):
endidx = len(line)
begidx = endidx
first_match = complete_tester(text, line, begidx, endidx, command_sets_manual)
out, err = capsys.readouterr()

assert first_match is None
assert command_sets_manual.completion_matches == []
assert "Could not find CommandSet instance" in out

command_sets_manual.unregister_command_set(user_unrelated)

Expand All @@ -865,9 +867,11 @@ def test_cross_commandset_completer(command_sets_manual):
endidx = len(line)
begidx = endidx
first_match = complete_tester(text, line, begidx, endidx, command_sets_manual)
out, err = capsys.readouterr()

assert first_match is None
assert command_sets_manual.completion_matches == []
assert "Could not find CommandSet instance" in out

command_sets_manual.unregister_command_set(user_unrelated)
command_sets_manual.unregister_command_set(user_sub2)
Expand Down

0 comments on commit 28bdb95

Please sign in to comment.