diff options
-rw-r--r-- | tests/test_cmd2.py | 11 | ||||
-rw-r--r-- | tests/test_transcript.py | 2 |
2 files changed, 12 insertions, 1 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index 0806bee3..d1906fc4 100644 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -12,6 +12,8 @@ import mock import pytest import six +from code import InteractiveConsole + import cmd2 from conftest import run_cmd, normalize, BASE_HELP, HELP_HISTORY, SHORTCUTS_TXT, SHOW_TXT, SHOW_LONG @@ -450,3 +452,12 @@ def test_edit_blank(base_app): os.remove(base_app.default_file_name) +def test_base_py_interactive(base_app): + # Mock out the InteractiveConsole.interact() call so we don't actually wait for a user's response on stdin + m = mock.MagicMock(name='interact') + InteractiveConsole.interact = m + + run_cmd(base_app, "py") + + # Make sure our mock was called once and only once + m.assert_called_once() diff --git a/tests/test_transcript.py b/tests/test_transcript.py index d11eb02a..c3a32eac 100644 --- a/tests/test_transcript.py +++ b/tests/test_transcript.py @@ -236,7 +236,7 @@ def test_commands_at_invocation(_cmdline_app): def test_select_options(_demo_app): - # Mock out the input call so we don't actually wait for a user's `response on stdin + # Mock out the input call so we don't actually wait for a user's response on stdin m = mock.MagicMock(name='input', return_value='2') sm.input = m |