summaryrefslogtreecommitdiff
path: root/tests/test_cmd2.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2019-07-21 00:21:28 -0400
committerGitHub <noreply@github.com>2019-07-21 00:21:28 -0400
commit73d1c34ae199415051a6209c726b099660944499 (patch)
tree31dcb1fd807e255a388e56b80dcf0279fd1899b0 /tests/test_cmd2.py
parent578593f8a9011ad71d78cd30f231c79af570987e (diff)
parent4b91f6355795d7bd23ff46882fd7181a3a11a419 (diff)
downloadcmd2-git-73d1c34ae199415051a6209c726b099660944499.tar.gz
Merge pull request #737 from python-cmd2/renames
Changes made while preparing for PyOhio presentation
Diffstat (limited to 'tests/test_cmd2.py')
-rw-r--r--tests/test_cmd2.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py
index 1bdbea5f..4a9dca31 100644
--- a/tests/test_cmd2.py
+++ b/tests/test_cmd2.py
@@ -331,6 +331,15 @@ def test_run_script_with_binary_file(base_app, request):
out, err = run_cmd(base_app, 'run_script {}'.format(filename))
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))
+ assert "appears to be a Python file" in err[0]
+
def test_run_script_with_utf8_file(base_app, request):
test_dir = os.path.dirname(request.module.__file__)
filename = os.path.join(test_dir, 'scripts', 'utf8.txt')