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

Side by Side Diff: recipe_engine/step_runner.py

Issue 2387763003: Add initial postprocess unit test thingy. (Closed)
Patch Set: rewrite parser code 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 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 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 self._test_data.expected_exception)) 464 self._test_data.expected_exception))
465 465
466 def _rendered_step_to_dict(self, rs): 466 def _rendered_step_to_dict(self, rs):
467 d = rs.config.render_to_dict() 467 d = rs.config.render_to_dict()
468 if rs.followup_annotations: 468 if rs.followup_annotations:
469 d['~followup_annotations'] = rs.followup_annotations 469 d['~followup_annotations'] = rs.followup_annotations
470 return d 470 return d
471 471
472 @property 472 @property
473 def steps_ran(self): 473 def steps_ran(self):
474 return [self._rendered_step_to_dict(rs) 474 return collections.OrderedDict(
475 for rs in self._step_history.itervalues()] 475 (name, self._rendered_step_to_dict(rs))
476 for name, rs in self._step_history.iteritems())
476 477
477 478
478 # Placeholders associated with a rendered step. 479 # Placeholders associated with a rendered step.
479 Placeholders = collections.namedtuple('Placeholders', 480 Placeholders = collections.namedtuple('Placeholders',
480 ('inputs_cmd', 'outputs_cmd', 'stdout', 'stderr', 'stdin')) 481 ('inputs_cmd', 'outputs_cmd', 'stdout', 'stderr', 'stdin'))
481 482
482 # Result of 'render_step'. 483 # Result of 'render_step'.
483 # 484 #
484 # Fields: 485 # Fields:
485 # config (recipe_api.StepConfig): The step configuration. 486 # config (recipe_api.StepConfig): The step configuration.
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 supplied command, and only uses the |env| kwarg for modifying the environment 671 supplied command, and only uses the |env| kwarg for modifying the environment
671 of the child process. 672 of the child process.
672 """ 673 """
673 saved_path = os.environ['PATH'] 674 saved_path = os.environ['PATH']
674 try: 675 try:
675 if path is not None: 676 if path is not None:
676 os.environ['PATH'] = path 677 os.environ['PATH'] = path
677 yield 678 yield
678 finally: 679 finally:
679 os.environ['PATH'] = saved_path 680 os.environ['PATH'] = saved_path
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698