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

Side by Side Diff: recipe_engine/unittests/stream_test.py

Issue 2322093002: Track step nesting in StreamEngine (Reland). (Closed)
Patch Set: Might as well go deeper. Created 4 years, 3 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/unittests/run_test.py ('k') | recipe_modules/generator_script/api.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 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2015 The LUCI Authors. All rights reserved. 2 # Copyright 2015 The LUCI Authors. All rights reserved.
3 # Use of this source code is governed under the Apache License, Version 2.0 3 # Use of this source code is governed under the Apache License, Version 2.0
4 # that can be found in the LICENSE file. 4 # that can be found in the LICENSE file.
5 5
6 import cStringIO 6 import cStringIO
7 import os 7 import os
8 import sys 8 import sys
9 import unittest 9 import unittest
10 10
(...skipping 18 matching lines...) Expand all
29 29
30 foo.add_step_link('read it online!', 'https://foospoemtobar.com/') 30 foo.add_step_link('read it online!', 'https://foospoemtobar.com/')
31 foo.add_step_summary_text('read a killer poem and took a bow') 31 foo.add_step_summary_text('read a killer poem and took a bow')
32 foo.trigger('{"builderName":["bar\'s fantasies"]}') 32 foo.trigger('{"builderName":["bar\'s fantasies"]}')
33 foo.close() 33 foo.close()
34 34
35 # TODO(luqui): N.B. stream interleaving is not really possible with 35 # TODO(luqui): N.B. stream interleaving is not really possible with
36 # subannotations, since the subannotator stream could have changed the 36 # subannotations, since the subannotator stream could have changed the
37 # active step. To do this right we would need to parse and re-emit 37 # active step. To do this right we would need to parse and re-emit
38 # subannotations. 38 # subannotations.
39 bars_baby = engine.new_step_stream('bar\'s baby', allow_subannotations=True) 39 bars_baby = engine.new_step_stream(
40 bars_baby.set_nest_level(1) 40 'bar\'s baby',
41 allow_subannotations=True,
42 nest_level=1)
41 bars_baby.write_line('I\'m in bar\'s imagination!!') 43 bars_baby.write_line('I\'m in bar\'s imagination!!')
42 bars_baby.write_line('@@@STEP_WARNINGS@@@') 44 bars_baby.write_line('@@@STEP_WARNINGS@@@')
43 bars_baby.reset_subannotation_state() 45 bars_baby.reset_subannotation_state()
44 bars_baby.close() 46 bars_baby.close()
45 47
46 bar.set_build_property('is_babycrazy', 'true') 48 bar.set_build_property('is_babycrazy', 'true')
47 bar.write_line('bar tries to kiss foo, but foo already left') 49 bar.write_line('bar tries to kiss foo, but foo already left')
48 bar.write_line('@@@KISS@foo@@@') 50 bar.write_line('@@@KISS@foo@@@')
49 bar.set_step_status('EXCEPTION') 51 bar.set_step_status('EXCEPTION')
50 bar.close() 52 bar.close()
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 159
158 def test_buildbot_status_constraint(self): 160 def test_buildbot_status_constraint(self):
159 with stream.StreamEngineInvariants() as engine: 161 with stream.StreamEngineInvariants() as engine:
160 foo = engine.new_step_stream('foo') 162 foo = engine.new_step_stream('foo')
161 foo.set_step_status('FAILURE') 163 foo.set_step_status('FAILURE')
162 with self.assertRaises(AssertionError): 164 with self.assertRaises(AssertionError):
163 foo.set_step_status('SUCCESS') 165 foo.set_step_status('SUCCESS')
164 166
165 if __name__ == '__main__': 167 if __name__ == '__main__':
166 unittest.main() 168 unittest.main()
OLDNEW
« no previous file with comments | « recipe_engine/unittests/run_test.py ('k') | recipe_modules/generator_script/api.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698