| OLD | NEW |
| 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 | |
| 8 import sys | |
| 9 import unittest | 7 import unittest |
| 10 | 8 |
| 11 import test_env | 9 import test_env |
| 12 | 10 |
| 13 from recipe_engine import recipe_api | |
| 14 from recipe_engine import stream | 11 from recipe_engine import stream |
| 15 | 12 |
| 16 class StreamTest(unittest.TestCase): | 13 class StreamTest(unittest.TestCase): |
| 17 def _example(self, engine): | 14 def _example(self, engine): |
| 18 foo = engine.make_step_stream('foo') | 15 foo = engine.make_step_stream('foo') |
| 19 foo.write_line('foo says hello to xyrself') | 16 foo.write_line('foo says hello to xyrself') |
| 20 | 17 |
| 21 bar = engine.make_step_stream('bar') | 18 bar = engine.make_step_stream('bar') |
| 22 foo.write_split('foo says hello to bar:\n hi bar') | 19 foo.write_split('foo says hello to bar:\n hi bar') |
| 23 bar.write_line('bar says hi, shyly') | 20 bar.write_line('bar says hi, shyly') |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 | 156 |
| 160 def test_buildbot_status_constraint(self): | 157 def test_buildbot_status_constraint(self): |
| 161 with stream.StreamEngineInvariants() as engine: | 158 with stream.StreamEngineInvariants() as engine: |
| 162 foo = engine.make_step_stream('foo') | 159 foo = engine.make_step_stream('foo') |
| 163 foo.set_step_status('FAILURE') | 160 foo.set_step_status('FAILURE') |
| 164 with self.assertRaises(AssertionError): | 161 with self.assertRaises(AssertionError): |
| 165 foo.set_step_status('SUCCESS') | 162 foo.set_step_status('SUCCESS') |
| 166 | 163 |
| 167 if __name__ == '__main__': | 164 if __name__ == '__main__': |
| 168 unittest.main() | 165 unittest.main() |
| OLD | NEW |