| OLD | NEW |
| 1 Recipes | 1 Recipes |
| 2 ======= | 2 ======= |
| 3 Recipes are a flexible way to specify How to Do Things, without knowing too much | 3 Recipes are a flexible way to specify How to Do Things, without knowing too much |
| 4 about those Things. | 4 about those Things. |
| 5 | 5 |
| 6 | 6 |
| 7 Background | 7 Background |
| 8 ---------- | 8 ---------- |
| 9 | 9 |
| 10 Chromium uses BuildBot for its builds. It requires master restarts to change | 10 Chromium uses BuildBot for its builds. It requires master restarts to change |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 ```python | 343 ```python |
| 344 for TARGET in ('Bob', 'DarthVader', 'Charlie'): | 344 for TARGET in ('Bob', 'DarthVader', 'Charlie'): |
| 345 for test_function in (super_tool, default_tool): | 345 for test_function in (super_tool, default_tool): |
| 346 yield TestCase(test_function(BasicSchema(TARGET))) | 346 yield TestCase(test_function(BasicSchema(TARGET))) |
| 347 ``` | 347 ``` |
| 348 | 348 |
| 349 Next, we get to the `config_ctx`. This is the 'context' for all the config | 349 Next, we get to the `config_ctx`. This is the 'context' for all the config |
| 350 items in this file, and will become the `CONFIG_CTX` for the entire module. | 350 items in this file, and will become the `CONFIG_CTX` for the entire module. |
| 351 Other modules may add into this config context (for example, they could have | 351 Other modules may add into this config context (for example, they could have |
| 352 a `hello_config.py` file, which imports this config context like | 352 a `hello_config.py` file, which imports this config context like |
| 353 `from RECIPE_MODULES.hello import CONFIG_CTX`. This will be useful for | 353 |
| 354 separation of concerns with the `set_config()` method.). The string format | 354 ```python |
| 355 argument that `config_item_context` takes will be used to format the test case | 355 import DEPS |
| 356 names and test expectation file names. Not terribly useful here, but it can be | 356 CONFIG_CTX = DEPS['hello'].CONFIG_CTX |
| 357 useful for making the test names more obvious in more complex cases. | 357 ``` |
| 358 |
| 359 |
| 360 This will be useful for separation of concerns with the `set_config()` |
| 361 method.). The string format argument that `config_item_context` takes will be |
| 362 used to format the test case names and test expectation file names. Not |
| 363 terribly useful here, but it can be useful for making the test names more |
| 364 obvious in more complex cases. |
| 358 | 365 |
| 359 Finally we get to the config items themselves. A config item is a function | 366 Finally we get to the config items themselves. A config item is a function |
| 360 decorated with the `config_ctx`, and takes a config blob as 'c'. The config item | 367 decorated with the `config_ctx`, and takes a config blob as 'c'. The config item |
| 361 updates the config blob, perhaps conditionally. There are many features to | 368 updates the config blob, perhaps conditionally. There are many features to |
| 362 `slave/recipe_config.py`. I would recommend reading the docstrings there | 369 `slave/recipe_config.py`. I would recommend reading the docstrings there |
| 363 for all the details. | 370 for all the details. |
| 364 | 371 |
| 365 Now that we have our config, let's use it. | 372 Now that we have our config, let's use it. |
| 366 | 373 |
| 367 ```python | 374 ```python |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 Where's the docs on `*.py`? | 540 Where's the docs on `*.py`? |
| 534 -------------------------------------------- | 541 -------------------------------------------- |
| 535 Check the docstrings in `*.py`. `<trollface text="Problem?"/>` | 542 Check the docstrings in `*.py`. `<trollface text="Problem?"/>` |
| 536 | 543 |
| 537 In addition, most recipe modules have an `example.py` file which exercises most | 544 In addition, most recipe modules have an `example.py` file which exercises most |
| 538 of the code in the module for both test coverage and example purposes. | 545 of the code in the module for both test coverage and example purposes. |
| 539 | 546 |
| 540 If you want to know what keys a step dictionary can take, take a look at | 547 If you want to know what keys a step dictionary can take, take a look at |
| 541 `common/annotator.py`. | 548 `common/annotator.py`. |
| 542 | 549 |
| OLD | NEW |