| OLD | NEW |
| (Empty) |
| 1 # Copyright 2017 The LUCI Authors. All rights reserved. | |
| 2 # Use of this source code is governed under the Apache License, Version 2.0 | |
| 3 # that can be found in the LICENSE file. | |
| 4 | |
| 5 DEPS = [ | |
| 6 'raw_io', | |
| 7 'step', | |
| 8 ] | |
| 9 | |
| 10 | |
| 11 def RunSteps(api): | |
| 12 # Read command's stdout and stderr. | |
| 13 step_result = api.step('echo', ['echo', 'Hello World'], | |
| 14 stdout=api.raw_io.output(), | |
| 15 stderr=api.raw_io.output()) | |
| 16 | |
| 17 # Pass stuff to command's stdin, read it from stdout. | |
| 18 step_result = api.step('cat', ['cat'], | |
| 19 stdin=api.raw_io.input_text(data='hello'), | |
| 20 stdout=api.raw_io.output('out')) | |
| 21 | |
| 22 # Example of auto-mocking stdout. '\n' appended to mock 'echo' behavior. | |
| 23 step_result = api.step( | |
| 24 'automock', | |
| 25 ['echo', 'huh'], | |
| 26 stdout=api.raw_io.output('out'), | |
| 27 step_test_data=( | |
| 28 lambda: api.raw_io.test_api.stream_output('huh\n'))) | |
| 29 assert step_result.stdout == 'huh\n' | |
| 30 | |
| 31 | |
| 32 def GenTests(api): | |
| 33 yield api.test('basic') | |
| OLD | NEW |