| OLD | NEW |
| 1 # Copyright 2014 The LUCI Authors. All rights reserved. | 1 # Copyright 2014 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 """Provides simulator test coverage for individual recipes.""" | 5 """Provides simulator test coverage for individual recipes.""" |
| 6 | 6 |
| 7 import StringIO | 7 import StringIO |
| 8 import contextlib | 8 import contextlib |
| 9 import json | 9 import json |
| 10 import logging | 10 import logging |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 class SimulationAnnotatorStreamEngine(stream.AnnotatorStreamEngine): | 61 class SimulationAnnotatorStreamEngine(stream.AnnotatorStreamEngine): |
| 62 | 62 |
| 63 def __init__(self): | 63 def __init__(self): |
| 64 self._step_buffer_map = {} | 64 self._step_buffer_map = {} |
| 65 super(SimulationAnnotatorStreamEngine, self).__init__( | 65 super(SimulationAnnotatorStreamEngine, self).__init__( |
| 66 self.step_buffer(None)) | 66 self.step_buffer(None)) |
| 67 | 67 |
| 68 def step_buffer(self, step_name): | 68 def step_buffer(self, step_name): |
| 69 return self._step_buffer_map.setdefault(step_name, StringIO.StringIO()) | 69 return self._step_buffer_map.setdefault(step_name, StringIO.StringIO()) |
| 70 | 70 |
| 71 def _new_step_stream(self, step_name, allow_subannotations, nest_level): | 71 def new_step_stream(self, step_config): |
| 72 return self._create_step_stream( | 72 return self._create_step_stream(step_config, |
| 73 step_name, | 73 self.step_buffer(step_config.name)) |
| 74 self.step_buffer(step_name), | |
| 75 allow_subannotations, | |
| 76 nest_level) | |
| 77 | 74 |
| 78 | 75 |
| 79 def RunRecipe(test_data): | 76 def RunRecipe(test_data): |
| 80 """Actually runs the recipe given the GenTests-supplied test_data.""" | 77 """Actually runs the recipe given the GenTests-supplied test_data.""" |
| 81 from . import config_types | 78 from . import config_types |
| 82 from . import loader | 79 from . import loader |
| 83 from . import run | 80 from . import run |
| 84 from . import step_runner | 81 from . import step_runner |
| 85 from . import stream | 82 from . import stream |
| 86 | 83 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 'TESTING_SLAVENAME']: | 184 'TESTING_SLAVENAME']: |
| 188 if env_var in os.environ: | 185 if env_var in os.environ: |
| 189 logging.warn("Ignoring %s environment variable." % env_var) | 186 logging.warn("Ignoring %s environment variable." % env_var) |
| 190 os.environ.pop(env_var) | 187 os.environ.pop(env_var) |
| 191 | 188 |
| 192 global _UNIVERSE | 189 global _UNIVERSE |
| 193 _UNIVERSE = universe | 190 _UNIVERSE = universe |
| 194 | 191 |
| 195 expect_tests.main('recipe_simulation_test', GenerateTests, | 192 expect_tests.main('recipe_simulation_test', GenerateTests, |
| 196 cover_omit=cover_omit(), args=args) | 193 cover_omit=cover_omit(), args=args) |
| OLD | NEW |