summaryrefslogtreecommitdiff
path: root/tests/test_pyscript.py
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2019-06-14 18:12:39 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2019-06-14 18:12:39 -0400
commit85dbe035114330a15abd5af6e098ef6948fa6cb0 (patch)
treee087dfa160eba882dcbd623609cab763efbd1ebc /tests/test_pyscript.py
parent3329e5fec21f2cc4479bb3358170e2226885ab3b (diff)
parentddd07f9cd6d72baca1232ae98856cf3b3d564706 (diff)
downloadcmd2-git-85dbe035114330a15abd5af6e098ef6948fa6cb0.tar.gz
Merge branch 'master' into history_fixes
Diffstat (limited to 'tests/test_pyscript.py')
-rw-r--r--tests/test_pyscript.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_pyscript.py b/tests/test_pyscript.py
index 4866548b..8da4b35a 100644
--- a/tests/test_pyscript.py
+++ b/tests/test_pyscript.py
@@ -40,3 +40,17 @@ def test_pyscript_stdout_capture(base_app, request):
assert out[0] == "PASSED"
assert out[1] == "PASSED"
+
+def test_pyscript_stop(base_app, request):
+ # Verify onecmd_plus_hooks() returns True if any commands in a pyscript return True for stop
+ test_dir = os.path.dirname(request.module.__file__)
+
+ # help.py doesn't run any commands that returns True for stop
+ python_script = os.path.join(test_dir, 'pyscript', 'help.py')
+ stop = base_app.onecmd_plus_hooks('pyscript {}'.format(python_script))
+ assert not stop
+
+ # stop.py runs the quit command which does return True for stop
+ python_script = os.path.join(test_dir, 'pyscript', 'stop.py')
+ stop = base_app.onecmd_plus_hooks('pyscript {}'.format(python_script))
+ assert stop