Skip to content

Commit c319cd3

Browse files
committed
Fix unit tests
1 parent 1cd0a38 commit c319cd3

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

cmd2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1501,7 +1501,7 @@ def sigint_handler(self, signum, frame):
15011501
def preloop(self):
15021502
"""Hook method executed once when the cmdloop() method is called."""
15031503
# Register a default SIGINT signal handler for Ctrl+C
1504-
signal.signal(signalnum=signal.SIGINT, handler=self.sigint_handler)
1504+
signal.signal(signal.SIGINT, self.sigint_handler)
15051505

15061506
def precmd(self, statement):
15071507
"""Hook method executed just before the command is processed by ``onecmd()`` and after adding it to the history.

tests/test_cmd2.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -915,6 +915,8 @@ def say_app():
915915
return app
916916

917917
def test_interrupt_quit(say_app):
918+
say_app.quit_on_sigint = True
919+
918920
# Mock out the input call so we don't actually wait for a user's response on stdin
919921
m = mock.MagicMock(name='input')
920922
m.side_effect = ['say hello', KeyboardInterrupt(), 'say goodbye', 'eof']

0 commit comments

Comments
 (0)