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

Side by Side Diff: recipe_engine/simulation_test.py

Issue 2265673002: Add LogDog / annotation protobuf support. (Closed) Base URL: https://github.com/luci/recipes-py@step-formal-struct
Patch Set: Stronger flush meta logic, moar test. 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
« no previous file with comments | « recipe_engine/recipe_api.py ('k') | recipe_engine/stream.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 """Actually runs the recipe given the GenTests-supplied test_data.""" 74 """Actually runs the recipe given the GenTests-supplied test_data."""
75 from . import config_types 75 from . import config_types
76 from . import loader 76 from . import loader
77 from . import run 77 from . import run
78 from . import step_runner 78 from . import step_runner
79 from . import stream 79 from . import stream
80 80
81 config_types.ResetTostringFns() 81 config_types.ResetTostringFns()
82 82
83 annotator = SimulationAnnotatorStreamEngine() 83 annotator = SimulationAnnotatorStreamEngine()
84 stream_engine = stream.ProductStreamEngine( 84 with stream.StreamEngineInvariants.wrap(annotator) as stream_engine:
85 stream.StreamEngineInvariants(),
86 annotator)
87 with stream_engine:
88 step_runner = step_runner.SimulationStepRunner(stream_engine, test_data, 85 step_runner = step_runner.SimulationStepRunner(stream_engine, test_data,
89 annotator) 86 annotator)
90 87
91 engine = run.RecipeEngine(step_runner, test_data.properties, _UNIVERSE) 88 engine = run.RecipeEngine(step_runner, test_data.properties, _UNIVERSE)
92 recipe_script = _UNIVERSE.load_recipe(test_data.properties['recipe']) 89 recipe_script = _UNIVERSE.load_recipe(test_data.properties['recipe'])
93 api = loader.create_recipe_api(recipe_script.LOADED_DEPS, engine, test_data) 90 api = loader.create_recipe_api(recipe_script.LOADED_DEPS, engine, test_data)
94 result = engine.run(recipe_script, api) 91 result = engine.run(recipe_script, api)
95 92
96 # Don't include tracebacks in expectations because they are too sensitive to 93 # Don't include tracebacks in expectations because they are too sensitive to
97 # change. 94 # change.
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 'TESTING_SLAVENAME']: 190 'TESTING_SLAVENAME']:
194 if env_var in os.environ: 191 if env_var in os.environ:
195 logging.warn("Ignoring %s environment variable." % env_var) 192 logging.warn("Ignoring %s environment variable." % env_var)
196 os.environ.pop(env_var) 193 os.environ.pop(env_var)
197 194
198 global _UNIVERSE 195 global _UNIVERSE
199 _UNIVERSE = universe 196 _UNIVERSE = universe
200 197
201 expect_tests.main('recipe_simulation_test', GenerateTests, 198 expect_tests.main('recipe_simulation_test', GenerateTests,
202 cover_omit=cover_omit(), args=args) 199 cover_omit=cover_omit(), args=args)
OLDNEW
« no previous file with comments | « recipe_engine/recipe_api.py ('k') | recipe_engine/stream.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698