@@ -1393,9 +1393,9 @@ def test_pseudo_raw_input_tty_rawinput_true():
1393
1393
# use context managers so original functions get put back when we are done
1394
1394
# we dont use decorators because we need m_input for the assertion
1395
1395
with mock .patch ('sys.stdin.isatty' ,
1396
- mock .MagicMock (name = 'isatty' , return_value = True )):
1396
+ mock .MagicMock (name = 'isatty' , return_value = True )):
1397
1397
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 :
1399
1399
# run the cmdloop, which should pull input from our mocks
1400
1400
app = cmd2 .Cmd ()
1401
1401
app .use_rawinput = True
@@ -1409,7 +1409,7 @@ def test_pseudo_raw_input_tty_rawinput_true():
1409
1409
1410
1410
def test_pseudo_raw_input_tty_rawinput_false ():
1411
1411
# gin up some input like it's coming from a tty
1412
- fakein = io .StringIO (u'{}' .format ('set\n quit \ n ' ))
1412
+ fakein = io .StringIO (u'{}' .format ('set\n ' ))
1413
1413
mtty = mock .MagicMock (name = 'isatty' , return_value = True )
1414
1414
fakein .isatty = mtty
1415
1415
mreadline = mock .MagicMock (name = 'readline' , wraps = fakein .readline )
@@ -1440,7 +1440,8 @@ def piped_rawinput_true(capsys, echo, command):
1440
1440
1441
1441
# using the decorator puts the original function at six.moves.input
1442
1442
# 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 ]))
1444
1445
def test_pseudo_raw_input_piped_rawinput_true_echo_true (capsys ):
1445
1446
command = 'set'
1446
1447
app , out = piped_rawinput_true (capsys , True , command )
@@ -1450,7 +1451,8 @@ def test_pseudo_raw_input_piped_rawinput_true_echo_true(capsys):
1450
1451
1451
1452
# using the decorator puts the original function at six.moves.input
1452
1453
# 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 ]))
1454
1456
def test_pseudo_raw_input_piped_rawinput_true_echo_false (capsys ):
1455
1457
command = 'set'
1456
1458
app , out = piped_rawinput_true (capsys , False , command )
0 commit comments