OLD | NEW |
1 # Copyright 2016 The LUCI Authors. All rights reserved. | 1 # Copyright 2016 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 import StringIO | 5 import StringIO |
6 import collections | 6 import collections |
7 import contextlib | 7 import contextlib |
8 import datetime | 8 import datetime |
9 import json | 9 import json |
10 import os | 10 import os |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 """Pretends to run steps, instead recording what would have been run. | 389 """Pretends to run steps, instead recording what would have been run. |
390 | 390 |
391 This is the main workhorse of recipes.py simulation_test. Returns the log of | 391 This is the main workhorse of recipes.py simulation_test. Returns the log of |
392 steps that would have been run in steps_ran. Uses test_data to mock return | 392 steps that would have been run in steps_ran. Uses test_data to mock return |
393 values. | 393 values. |
394 """ | 394 """ |
395 | 395 |
396 # List of attributes in a recipe_api.StepConfig to omit when rendering | 396 # List of attributes in a recipe_api.StepConfig to omit when rendering |
397 # step history. | 397 # step history. |
398 _STEP_CONFIG_RENDER_BLACKLIST = set(( | 398 _STEP_CONFIG_RENDER_BLACKLIST = set(( |
| 399 'base_name', |
399 'nest_level', | 400 'nest_level', |
400 'ok_ret', | 401 'ok_ret', |
401 'infra_step', | 402 'infra_step', |
402 'step_test_data', | 403 'step_test_data', |
403 )) | 404 )) |
404 | 405 |
405 def __init__(self, stream_engine, test_data, annotator): | 406 def __init__(self, stream_engine, test_data, annotator): |
406 self._test_data = test_data | 407 self._test_data = test_data |
407 self._stream_engine = stream_engine | 408 self._stream_engine = stream_engine |
408 self._annotator = annotator | 409 self._annotator = annotator |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 supplied command, and only uses the |env| kwarg for modifying the environment | 681 supplied command, and only uses the |env| kwarg for modifying the environment |
681 of the child process. | 682 of the child process. |
682 """ | 683 """ |
683 saved_path = os.environ['PATH'] | 684 saved_path = os.environ['PATH'] |
684 try: | 685 try: |
685 if path is not None: | 686 if path is not None: |
686 os.environ['PATH'] = path | 687 os.environ['PATH'] = path |
687 yield | 688 yield |
688 finally: | 689 finally: |
689 os.environ['PATH'] = saved_path | 690 os.environ['PATH'] = saved_path |
OLD | NEW |