Run ``invocation`` via ``program``, returning output stream captures. ``program`` defaults to ``Program()``. To skip automatically assuming the argv under test starts with ``"invoke "``, say ``invoke=False``. :returns: Two-tuple of ``stdout, stderr`` strings.
(invocation, program=None, invoke=True)
| 54 | |
| 55 | @trap |
| 56 | def run(invocation, program=None, invoke=True): |
| 57 | """ |
| 58 | Run ``invocation`` via ``program``, returning output stream captures. |
| 59 | |
| 60 | ``program`` defaults to ``Program()``. |
| 61 | |
| 62 | To skip automatically assuming the argv under test starts with ``"invoke |
| 63 | "``, say ``invoke=False``. |
| 64 | |
| 65 | :returns: Two-tuple of ``stdout, stderr`` strings. |
| 66 | """ |
| 67 | if program is None: |
| 68 | program = Program() |
| 69 | if invoke: |
| 70 | invocation = "invoke {}".format(invocation) |
| 71 | program.run(invocation, exit=False) |
| 72 | return sys.stdout.getvalue(), sys.stderr.getvalue() |
| 73 | |
| 74 | |
| 75 | def expect( |
no test coverage detected