From 6fa5c56a0d457fa69ac43b1d0b6f733a71a697da Mon Sep 17 00:00:00 2001 From: Kevin Van Brunt Date: Mon, 10 Jun 2019 10:23:53 -0400 Subject: Added unit test --- tests/test_pyscript.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests/test_pyscript.py') 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 -- cgit v1.2.1