diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-04-24 09:51:52 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-04-24 09:51:52 -0400 |
commit | 316dafd0585ae2c5b027e67db9459fac0cc8ffd8 (patch) | |
tree | 7b3b69075a68d113fb46c131f2538c5ad2a5be03 /tests | |
parent | 034ee380d549cee507e80344e87bc016549750eb (diff) | |
download | cmd2-git-316dafd0585ae2c5b027e67db9459fac0cc8ffd8.tar.gz |
Updated comment
Diffstat (limited to 'tests')
-rw-r--r-- | tests/pyscript/stdout_capture.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/pyscript/stdout_capture.py b/tests/pyscript/stdout_capture.py index dfc39627..4aa78d53 100644 --- a/tests/pyscript/stdout_capture.py +++ b/tests/pyscript/stdout_capture.py @@ -5,15 +5,21 @@ import sys # The unit test framework passes in the string being printed by the command finalization hook hook_output = sys.argv[1] -# hook_output will not be captured because there are no nested calls to onecmd_plus_hooks +# Run a help command which results in 1 call to onecmd_plus_hooks res = app('help') + +# hook_output will not be captured because there are no nested calls to onecmd_plus_hooks if hook_output not in res.stdout: print("PASSED") else: print("FAILED") -# hook_output will be captured in the nested call to onecmd_plus_hooks that occurs in do_history() +# Run the last command in the history res = app('history -r -1') + +# All output of the history command will be captured. This includes all output of the commands +# started in do_history() using onecmd_plus_hooks(), including any output in those commands' hooks. +# Therefore we expect the hook_output to show up this time. if hook_output in res.stdout: print("PASSED") else: |