summaryrefslogtreecommitdiff
path: root/tests/test_cmd2.py
diff options
context:
space:
mode:
authorJared Crapo <jared@kotfu.net>2017-08-23 23:42:25 -0600
committerJared Crapo <jared@kotfu.net>2017-08-23 23:42:25 -0600
commit9ab2614baeee1747ef8398b43207ebf2f64210e7 (patch)
treeb40bb9f9b2c255f75c88a65fb959b723202b6b27 /tests/test_cmd2.py
parent411ef56f5007f4b19039238e9f5d8313a2316ca9 (diff)
downloadcmd2-git-9ab2614baeee1747ef8398b43207ebf2f64210e7.tar.gz
Pick up a few more lines of test coverage
Diffstat (limited to 'tests/test_cmd2.py')
-rw-r--r--tests/test_cmd2.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py
index f7ef02a3..6e1e6ef5 100644
--- a/tests/test_cmd2.py
+++ b/tests/test_cmd2.py
@@ -1393,9 +1393,9 @@ def test_pseudo_raw_input_tty_rawinput_true():
# use context managers so original functions get put back when we are done
# we dont use decorators because we need m_input for the assertion
with mock.patch('sys.stdin.isatty',
- mock.MagicMock(name='isatty', return_value=True)):
+ mock.MagicMock(name='isatty', return_value=True)):
with mock.patch('six.moves.input',
- mock.MagicMock(name='input', side_effect=['set', 'quit'])) as m_input:
+ mock.MagicMock(name='input', side_effect=['set', EOFError])) as m_input:
# run the cmdloop, which should pull input from our mocks
app = cmd2.Cmd()
app.use_rawinput = True
@@ -1409,7 +1409,7 @@ def test_pseudo_raw_input_tty_rawinput_true():
def test_pseudo_raw_input_tty_rawinput_false():
# gin up some input like it's coming from a tty
- fakein = io.StringIO(u'{}'.format('set\nquit\n'))
+ fakein = io.StringIO(u'{}'.format('set\n'))
mtty = mock.MagicMock(name='isatty', return_value=True)
fakein.isatty = mtty
mreadline = mock.MagicMock(name='readline', wraps=fakein.readline)
@@ -1440,7 +1440,8 @@ def piped_rawinput_true(capsys, echo, command):
# using the decorator puts the original function at six.moves.input
# back when this method returns
-@mock.patch('six.moves.input', mock.MagicMock(name='input', side_effect=['set', 'quit']))
+@mock.patch('six.moves.input',
+ mock.MagicMock(name='input', side_effect=['set', EOFError]))
def test_pseudo_raw_input_piped_rawinput_true_echo_true(capsys):
command = 'set'
app, out = piped_rawinput_true(capsys, True, command)
@@ -1450,7 +1451,8 @@ def test_pseudo_raw_input_piped_rawinput_true_echo_true(capsys):
# using the decorator puts the original function at six.moves.input
# back when this method returns
-@mock.patch('six.moves.input', mock.MagicMock(name='input', side_effect=['set', 'quit']))
+@mock.patch('six.moves.input',
+ mock.MagicMock(name='input', side_effect=['set', EOFError]))
def test_pseudo_raw_input_piped_rawinput_true_echo_false(capsys):
command = 'set'
app, out = piped_rawinput_true(capsys, False, command)