OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 The LUCI Authors. All rights reserved. | 2 # Copyright 2014 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 json | 6 import json |
7 import os | 7 import os |
8 import re | 8 import re |
9 import subprocess | 9 import subprocess |
10 import unittest | 10 import unittest |
(...skipping 28 matching lines...) Expand all Loading... |
39 os.environ[requests_ssl.ENV_VAR_IGNORE] = '1' | 39 os.environ[requests_ssl.ENV_VAR_IGNORE] = '1' |
40 os.environ['RANDOM_MULTILINE_ENV'] = 'foo\nbar\nbaz\n' | 40 os.environ['RANDOM_MULTILINE_ENV'] = 'foo\nbar\nbaz\n' |
41 try: | 41 try: |
42 return ( | 42 return ( |
43 ['python', script_path] + eng_args + ['run', recipe] + proplist) | 43 ['python', script_path] + eng_args + ['run', recipe] + proplist) |
44 finally: | 44 finally: |
45 os.environ[requests_ssl.ENV_VAR_IGNORE] = prev_ignore | 45 os.environ[requests_ssl.ENV_VAR_IGNORE] = prev_ignore |
46 | 46 |
47 def _test_recipe(self, recipe, properties=None): | 47 def _test_recipe(self, recipe, properties=None): |
48 proc = subprocess.Popen( | 48 proc = subprocess.Popen( |
49 self._run_cmd(recipe, properties), stdout=subprocess.PIPE) | 49 self._run_cmd(recipe, properties), |
50 proc.communicate() | 50 stdout=subprocess.PIPE, |
51 self.assertEqual(0, proc.returncode, '%d != %d when testing %s' % ( | 51 stderr=subprocess.STDOUT) |
52 0, proc.returncode, recipe)) | 52 stdout = proc.communicate() |
| 53 self.assertEqual(0, proc.returncode, '%d != %d when testing %s:\n%s' % ( |
| 54 0, proc.returncode, recipe, stdout)) |
53 | 55 |
54 def test_examples(self): | 56 def test_examples(self): |
55 tests = [ | 57 tests = [ |
56 ['step:example'], | 58 ['step:example'], |
57 ['path:example'], | 59 ['path:example'], |
58 ['raw_io:example'], | 60 ['raw_io:example'], |
59 ['python:example'], | 61 ['python:example'], |
60 ['json:example'], | 62 ['json:example'], |
61 ['uuid:example'], | 63 ['uuid:example'], |
62 | 64 |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 u'foo', | 258 u'foo', |
257 u'bar', | 259 u'bar', |
258 u'baz', | 260 u'baz', |
259 ], | 261 ], |
260 }) | 262 }) |
261 | 263 |
262 | 264 |
263 if __name__ == '__main__': | 265 if __name__ == '__main__': |
264 unittest.TestCase.maxDiff = None | 266 unittest.TestCase.maxDiff = None |
265 unittest.main() | 267 unittest.main() |
OLD | NEW |