summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_cmd2.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py
index 76470145..4fc9fd59 100644
--- a/tests/test_cmd2.py
+++ b/tests/test_cmd2.py
@@ -786,12 +786,11 @@ def test_cmdloop_without_rawinput(outsim_app):
testargs = ["prog"]
expected = outsim_app.intro + '\n'
with mock.patch.object(sys, 'argv', testargs):
- # Run the command loop
- outsim_app.cmdloop()
+ with pytest.raises(OSError):
+ outsim_app.cmdloop()
out = outsim_app.stdout.getvalue()
assert out == expected
-
class HookFailureApp(cmd2.Cmd):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@@ -840,7 +839,10 @@ def test_interrupt_quit(say_app):
m.side_effect = ['say hello', KeyboardInterrupt(), 'say goodbye', 'eof']
builtins.input = m
- say_app.cmdloop()
+ try:
+ say_app.cmdloop()
+ except KeyboardInterrupt:
+ pass
# And verify the expected output to stdout
out = say_app.stdout.getvalue()
@@ -854,7 +856,10 @@ def test_interrupt_noquit(say_app):
m.side_effect = ['say hello', KeyboardInterrupt(), 'say goodbye', 'eof']
builtins.input = m
- say_app.cmdloop()
+ try:
+ say_app.cmdloop()
+ except KeyboardInterrupt:
+ pass
# And verify the expected output to stdout
out = say_app.stdout.getvalue()