Skip to content

Commit 9ab2614

Browse files
committed
Pick up a few more lines of test coverage
1 parent 411ef56 commit 9ab2614

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

tests/test_cmd2.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1393,9 +1393,9 @@ def test_pseudo_raw_input_tty_rawinput_true():
13931393
# use context managers so original functions get put back when we are done
13941394
# we dont use decorators because we need m_input for the assertion
13951395
with mock.patch('sys.stdin.isatty',
1396-
mock.MagicMock(name='isatty', return_value=True)):
1396+
mock.MagicMock(name='isatty', return_value=True)):
13971397
with mock.patch('six.moves.input',
1398-
mock.MagicMock(name='input', side_effect=['set', 'quit'])) as m_input:
1398+
mock.MagicMock(name='input', side_effect=['set', EOFError])) as m_input:
13991399
# run the cmdloop, which should pull input from our mocks
14001400
app = cmd2.Cmd()
14011401
app.use_rawinput = True
@@ -1409,7 +1409,7 @@ def test_pseudo_raw_input_tty_rawinput_true():
14091409

14101410
def test_pseudo_raw_input_tty_rawinput_false():
14111411
# gin up some input like it's coming from a tty
1412-
fakein = io.StringIO(u'{}'.format('set\nquit\n'))
1412+
fakein = io.StringIO(u'{}'.format('set\n'))
14131413
mtty = mock.MagicMock(name='isatty', return_value=True)
14141414
fakein.isatty = mtty
14151415
mreadline = mock.MagicMock(name='readline', wraps=fakein.readline)
@@ -1440,7 +1440,8 @@ def piped_rawinput_true(capsys, echo, command):
14401440

14411441
# using the decorator puts the original function at six.moves.input
14421442
# back when this method returns
1443-
@mock.patch('six.moves.input', mock.MagicMock(name='input', side_effect=['set', 'quit']))
1443+
@mock.patch('six.moves.input',
1444+
mock.MagicMock(name='input', side_effect=['set', EOFError]))
14441445
def test_pseudo_raw_input_piped_rawinput_true_echo_true(capsys):
14451446
command = 'set'
14461447
app, out = piped_rawinput_true(capsys, True, command)
@@ -1450,7 +1451,8 @@ def test_pseudo_raw_input_piped_rawinput_true_echo_true(capsys):
14501451

14511452
# using the decorator puts the original function at six.moves.input
14521453
# back when this method returns
1453-
@mock.patch('six.moves.input', mock.MagicMock(name='input', side_effect=['set', 'quit']))
1454+
@mock.patch('six.moves.input',
1455+
mock.MagicMock(name='input', side_effect=['set', EOFError]))
14541456
def test_pseudo_raw_input_piped_rawinput_true_echo_false(capsys):
14551457
command = 'set'
14561458
app, out = piped_rawinput_true(capsys, False, command)

0 commit comments

Comments
 (0)