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

Side by Side Diff: recipes/engine_tests/whitelist_steps.py

Issue 2387763003: Add initial postprocess unit test thingy. (Closed)
Patch Set: Add nested statement too Created 4 years, 2 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 2015 The LUCI Authors. All rights reserved. 1 # Copyright 2015 The LUCI Authors. All rights reserved.
2 # Use of this source code is governed under the Apache License, Version 2.0 2 # Use of this source code is governed under the Apache License, Version 2.0
3 # that can be found in the LICENSE file. 3 # that can be found in the LICENSE file.
4 4
5 """Tests that step_data can accept multiple specs at once.""" 5 """Tests that step_data can accept multiple specs at once."""
6 6
7 from recipe_engine.recipe_api import Property
8 from recipe_engine.post_process import Filter, DoesNotRun, MustRun
9
7 DEPS = [ 10 DEPS = [
8 'step', 11 'step',
12 'properties',
9 ] 13 ]
10 14
11 def RunSteps(api): 15 PROPERTIES = {
16 'fakeit': Property(kind=bool, default=True),
Michael Achenbach 2016/10/13 07:45:08 Are you setting this to false anywhere? If not why
iannucci 2016/10/13 22:03:21 Oops! I did mean to set this to false in one of th
17 }
18
19 def RunSteps(api, fakeit):
12 api.step('something unimportant', ['echo', 'sup doc']) 20 api.step('something unimportant', ['echo', 'sup doc'])
13 api.step('something important', ['echo', 'crazy!'], env={'FLEEM': 'VERY YES'}) 21 api.step('something important', ['echo', 'crazy!'], env={'FLEEM': 'VERY YES'})
14 api.step('another important', ['echo', 'INSANITY']) 22 api.step('another important', ['echo', 'INSANITY'])
23 if fakeit:
24 api.step('fakestep', ['echo', 'FAAAAKE'])
25
15 26
16 def GenTests(api): 27 def GenTests(api):
17 yield api.test('all_steps') 28 yield api.test('all_steps') + api.post_process(MustRun, 'fakestep')
18 29
19 yield (api.test('single_step') 30 yield (api.test('single_step')
20 + api.whitelist('something important') 31 + api.post_process(Filter('something important'))
Michael Achenbach 2016/10/13 07:45:08 Maybe also demonstrate chaining of post-processing
iannucci 2016/10/13 22:03:21 done below
21 ) 32 )
22 33
23 yield (api.test('two_steps') 34 yield (api.test('two_steps')
24 + api.whitelist('something important') 35 + api.post_process(Filter('something important', 'another important'))
25 + api.whitelist('another important')
26 ) 36 )
27 37
28 yield (api.test('selection') 38 f = Filter()
29 + api.whitelist('something important', 'env') 39 f = f.include('something important', 'env')
Michael Achenbach 2016/10/13 07:45:08 Maybe change the order of filters to show that it'
iannucci 2016/10/13 22:03:21 Done.
30 + api.whitelist('another important', 'cmd') 40 f = f.include('another important', 'cmd')
41 yield (api.test('selection') + api.properties()
Michael Achenbach 2016/10/13 07:45:08 Why an empty properties? Did you use it to test ch
Michael Achenbach 2016/10/13 07:45:08 nit: new line for each +
iannucci 2016/10/13 22:03:21 That's the reason I missed it :p
iannucci 2016/10/13 22:03:21 yeah this is where I wanted to change fakeit :)
42 + api.post_process(f)
43 + api.post_process(DoesNotRun, 'fakestep')
31 ) 44 )
32 45
33 yield (api.test('result') 46 yield api.test('result') + api.post_process(Filter('$result'))
34 + api.whitelist('$result')
35 )
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698