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 | 7 import os |
8 import sys | 8 import sys |
9 import unittest | 9 import unittest |
10 | 10 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 self.assertEqual( | 113 self.assertEqual( |
114 stringio.getvalue().splitlines(), | 114 stringio.getvalue().splitlines(), |
115 self._example_annotations().splitlines()) | 115 self._example_annotations().splitlines()) |
116 | 116 |
117 def test_example_wellformed(self): | 117 def test_example_wellformed(self): |
118 with stream.StreamEngineInvariants() as engine: | 118 with stream.StreamEngineInvariants() as engine: |
119 self._example(engine) | 119 self._example(engine) |
120 | 120 |
121 def test_product_with_invariants_on_example(self): | 121 def test_product_with_invariants_on_example(self): |
122 stringio = cStringIO.StringIO() | 122 stringio = cStringIO.StringIO() |
123 engine = stream.ProductStreamEngine( | 123 engine = stream.StreamEngineInvariants.wrap( |
124 stream.StreamEngineInvariants(), | |
125 stream.AnnotatorStreamEngine( | 124 stream.AnnotatorStreamEngine( |
126 stringio, emit_timestamps=True, time_fn=self.fake_time)) | 125 stringio, emit_timestamps=True, time_fn=self.fake_time)) |
127 with engine: | 126 with engine: |
128 self._example(engine) | 127 self._example(engine) |
129 self.assertEqual(stringio.getvalue(), self._example_annotations()) | 128 self.assertEqual(stringio.getvalue(), self._example_annotations()) |
130 | 129 |
131 def test_noop(self): | 130 def test_noop(self): |
132 with stream.NoopStreamEngine() as engine: | 131 with stream.NoopStreamEngine() as engine: |
133 self._example(engine) | 132 self._example(engine) |
134 | 133 |
(...skipping 25 matching lines...) Expand all Loading... |
160 | 159 |
161 def test_buildbot_status_constraint(self): | 160 def test_buildbot_status_constraint(self): |
162 with stream.StreamEngineInvariants() as engine: | 161 with stream.StreamEngineInvariants() as engine: |
163 foo = engine.make_step_stream('foo') | 162 foo = engine.make_step_stream('foo') |
164 foo.set_step_status('FAILURE') | 163 foo.set_step_status('FAILURE') |
165 with self.assertRaises(AssertionError): | 164 with self.assertRaises(AssertionError): |
166 foo.set_step_status('SUCCESS') | 165 foo.set_step_status('SUCCESS') |
167 | 166 |
168 if __name__ == '__main__': | 167 if __name__ == '__main__': |
169 unittest.main() | 168 unittest.main() |
OLD | NEW |