summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2020-04-11 13:34:52 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2020-04-11 13:34:52 -0400
commitc5aa3fd31567574a9ed9fa97f7ba7e7083af707f (patch)
tree1c0043c78e702da2c5e5175d284cc8eeb6d46449 /tests
parentd815d2cd19a24bac89bd19416fb2b7cd0dadfe03 (diff)
parentc4fbd8fa618b5c48cc38ac5c262d3c1ec53ce9af (diff)
downloadcmd2-git-c5aa3fd31567574a9ed9fa97f7ba7e7083af707f.tar.gz
Merge branch 'master' into table_creator
Diffstat (limited to 'tests')
-rw-r--r--tests/pyscript/echo.py9
-rw-r--r--tests/test_run_pyscript.py9
2 files changed, 17 insertions, 1 deletions
diff --git a/tests/pyscript/echo.py b/tests/pyscript/echo.py
new file mode 100644
index 00000000..d95e19db
--- /dev/null
+++ b/tests/pyscript/echo.py
@@ -0,0 +1,9 @@
+# flake8: noqa F821
+# Tests echo argument to app()
+app.cmd_echo = False
+
+# echo defaults to current setting which is False, so this help text should not be echoed to pytest's stdout
+app('help alias')
+
+# pytest's stdout should have this help text written to it
+app('help edit', echo=True)
diff --git a/tests/test_run_pyscript.py b/tests/test_run_pyscript.py
index 811fd688..12257fc5 100644
--- a/tests/test_run_pyscript.py
+++ b/tests/test_run_pyscript.py
@@ -91,7 +91,6 @@ def test_run_pyscript_dir(base_app, request):
python_script = os.path.join(test_dir, 'pyscript', 'pyscript_dir.py')
out, err = run_cmd(base_app, 'run_pyscript {}'.format(python_script))
- assert out
assert out[0] == "['cmd_echo']"
def test_run_pyscript_stdout_capture(base_app, request):
@@ -123,3 +122,11 @@ def test_run_pyscript_environment(base_app, request):
out, err = run_cmd(base_app, 'run_pyscript {}'.format(python_script))
assert out[0] == "PASSED"
+
+def test_run_pyscript_app_echo(base_app, request):
+ test_dir = os.path.dirname(request.module.__file__)
+ python_script = os.path.join(test_dir, 'pyscript', 'echo.py')
+ out, err = run_cmd(base_app, 'run_pyscript {}'.format(python_script))
+
+ # Only the edit help text should have been echoed to pytest's stdout
+ assert out[0] == "Usage: edit [-h] [file_path]"