Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(505)

Side by Side Diff: recipe_modules/raw_io/example.py

Issue 1906323003: recipe engine: extract infra-specific paths out of the engine (Closed) Base URL: https://github.com/luci/recipes-py.git@master
Patch Set: tmp Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 DEPS = [ 5 DEPS = [
6 'path', 6 'path',
7 'properties', 7 'properties',
8 'python', 8 'python',
9 'raw_io', 9 'raw_io',
10 'step', 10 'step',
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 api.raw_io.test_api.stream_output('blah\n') + 42 api.raw_io.test_api.stream_output('blah\n') +
43 api.raw_io.test_api.stream_output('fail\n', 'stderr') 43 api.raw_io.test_api.stream_output('fail\n', 'stderr')
44 )) 44 ))
45 ) 45 )
46 assert step_result.stdout == 'blah\n' 46 assert step_result.stdout == 'blah\n'
47 assert step_result.stderr == 'fail\n' 47 assert step_result.stderr == 'fail\n'
48 48
49 # leak_to coverage. 49 # leak_to coverage.
50 step_result = api.step( 50 step_result = api.step(
51 'leak stdout', ['echo', 'leaking'], 51 'leak stdout', ['echo', 'leaking'],
52 stdout=api.raw_io.output(leak_to=api.path['slave_build'].join('out.txt')), 52 stdout=api.raw_io.output(leak_to=api.path['tmp'].join('out.txt')),
53 step_test_data=( 53 step_test_data=(
54 lambda: api.raw_io.test_api.stream_output('leaking\n'))) 54 lambda: api.raw_io.test_api.stream_output('leaking\n')))
55 assert step_result.stdout == 'leaking\n' 55 assert step_result.stdout == 'leaking\n'
56 56
57 api.step('list temp dir', ['ls', api.raw_io.output_dir()]) 57 api.step('list temp dir', ['ls', api.raw_io.output_dir()])
58 api.step('leak dir', ['ls', api.raw_io.output_dir( 58 api.step('leak dir', ['ls', api.raw_io.output_dir(
59 leak_to=api.path['slave_build'].join('out'))]) 59 leak_to=api.path['tmp'].join('out'))])
60 60
61 # Example of overriding default mocked output for a single named output. 61 # Example of overriding default mocked output for a single named output.
62 step_result = api.python.inline( 62 step_result = api.python.inline(
63 'override_default_mock', 63 'override_default_mock',
64 """ 64 """
65 import sys 65 import sys
66 with open(sys.argv[1], 'w') as f: 66 with open(sys.argv[1], 'w') as f:
67 f.write(%r) 67 f.write(%r)
68 """ % api.properties.get('some_prop', 'good_value'), 68 """ % api.properties.get('some_prop', 'good_value'),
69 args=[api.raw_io.output(name='test')], 69 args=[api.raw_io.output(name='test')],
(...skipping 15 matching lines...) Expand all
85 yield (api.test('basic') + 85 yield (api.test('basic') +
86 api.properties(some_prop='bad_value') + 86 api.properties(some_prop='bad_value') +
87 api.step_data('echo', 87 api.step_data('echo',
88 stdout=api.raw_io.output('Hello World\n'), 88 stdout=api.raw_io.output('Hello World\n'),
89 stderr=api.raw_io.output('')) + 89 stderr=api.raw_io.output('')) +
90 api.step_data('cat', 90 api.step_data('cat',
91 stdout=api.raw_io.output('hello')) + 91 stdout=api.raw_io.output('hello')) +
92 api.step_data('override_default_mock', 92 api.step_data('override_default_mock',
93 api.raw_io.output('good_value', name='test')) 93 api.raw_io.output('good_value', name='test'))
94 ) 94 )
OLDNEW
« no previous file with comments | « recipe_modules/python/example.expected/basic.json ('k') | recipe_modules/raw_io/example.expected/basic.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698