diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-07-20 23:54:00 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-07-20 23:54:00 -0400 |
commit | 7f3c48e96d428f10f246a783591ad970f482a6e1 (patch) | |
tree | e59abc7c94751566a4af333be5880e53fc08cd39 | |
parent | 2bee50a0b4caecda05ee385419bd927cfcac9cf1 (diff) | |
download | cmd2-git-7f3c48e96d428f10f246a783591ad970f482a6e1.tar.gz |
Added mock to unit test
-rw-r--r-- | tests/test_cmd2.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index 9ce02789..4a9dca31 100644 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -332,6 +332,9 @@ def test_run_script_with_binary_file(base_app, request): assert "is not an ASCII or UTF-8 encoded text file" in err[0] def test_run_script_with_python_file(base_app, request): + m = mock.MagicMock(name='input', return_value='2') + builtins.input = m + test_dir = os.path.dirname(request.module.__file__) filename = os.path.join(test_dir, 'pyscript', 'stop.py') out, err = run_cmd(base_app, 'run_script {}'.format(filename)) |