X-Git-Url: http://git.tremily.us/?p=hooke.git;a=blobdiff_plain;f=test%2Fcommand_stack.py;h=a706d6754af94fef575ae05eeb436d88fa3c8aa6;hp=48ef4d16c5dda6e556a6a7b1fdf879e3f5ff3328;hb=8aefc576eee45cedbc7cfe009c67bd0ff11e2468;hpb=ae47ed4b74a629ebd0d812ded07cb7b16c0fca91
diff --git a/test/command_stack.py b/test/command_stack.py
index 48ef4d1..a706d67 100644
--- a/test/command_stack.py
+++ b/test/command_stack.py
@@ -17,6 +17,8 @@
# .
"""
+>>> import logging
+>>> import sys
>>> from hooke.hooke import Hooke, HookeRunner
>>> h = Hooke()
>>> r = HookeRunner()
@@ -158,4 +160,45 @@ Success
[]
Success
+
+Building command stacks is fun, but its useless if you can't execute
+them. First, lets repopulate the in-memory stack.
+
+>>> h = r.run_lines(h, ['start_command_capture',
+... 'debug --attribute config',
+... 'version',
+... 'stop_command_capture']
+... ) # doctest: +REPORT_UDIFF
+Success
+
+Success
+
+Success
+
+Success
+
+
+Setup logging so we can check command output in the doctest.
+
+>>> log = logging.getLogger('hooke')
+>>> stdout_handler = logging.StreamHandler(sys.stdout)
+>>> log.addHandler(stdout_handler)
+
+Execute the stack. We use `h.run_command` because `sys.stdout` is
+replaced by a `doctest._SpoofOut`, and doctest has no way to collect
+those results from `run_lines`'s engine subprocess.
+
+>>> h.run_command('execute command stack', arguments={}
+... ) # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE, +REPORT_UDIFF
+engine running internal
+engine running internal
+engine message from debug ():
+
+engine message from debug ():
+engine running internal
+engine message from version (): Hooke 1.0.0.alpha (Ninken)
+----
+...
+engine message from version ():
+engine message from execute command stack ():
"""