Chromium Code Reviews| Index: recipes/engine_tests/whitelist_steps.py |
| diff --git a/recipes/engine_tests/whitelist_steps.py b/recipes/engine_tests/whitelist_steps.py |
| index bbc41a8d5b4c6dcca0174afa6837206a9e89d899..0e19f202d57a5dcfc6dbc76194d8fe276f80511f 100644 |
| --- a/recipes/engine_tests/whitelist_steps.py |
| +++ b/recipes/engine_tests/whitelist_steps.py |
| @@ -4,32 +4,43 @@ |
| """Tests that step_data can accept multiple specs at once.""" |
| +from recipe_engine.recipe_api import Property |
| +from recipe_engine.post_process import Filter, DoesNotRun, MustRun |
| + |
| DEPS = [ |
| 'step', |
| + 'properties', |
| ] |
| -def RunSteps(api): |
| +PROPERTIES = { |
| + '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
|
| +} |
| + |
| +def RunSteps(api, fakeit): |
| api.step('something unimportant', ['echo', 'sup doc']) |
| api.step('something important', ['echo', 'crazy!'], env={'FLEEM': 'VERY YES'}) |
| api.step('another important', ['echo', 'INSANITY']) |
| + if fakeit: |
| + api.step('fakestep', ['echo', 'FAAAAKE']) |
| + |
| def GenTests(api): |
| - yield api.test('all_steps') |
| + yield api.test('all_steps') + api.post_process(MustRun, 'fakestep') |
| yield (api.test('single_step') |
| - + api.whitelist('something important') |
| + + 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
|
| ) |
| yield (api.test('two_steps') |
| - + api.whitelist('something important') |
| - + api.whitelist('another important') |
| + + api.post_process(Filter('something important', 'another important')) |
| ) |
| - yield (api.test('selection') |
| - + api.whitelist('something important', 'env') |
| - + api.whitelist('another important', 'cmd') |
| + f = Filter() |
| + 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.
|
| + f = f.include('another important', 'cmd') |
| + 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 :)
|
| + + api.post_process(f) |
| + + api.post_process(DoesNotRun, 'fakestep') |
| ) |
| - yield (api.test('result') |
| - + api.whitelist('$result') |
| - ) |
| + yield api.test('result') + api.post_process(Filter('$result')) |