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

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

Issue 2875823002: Add vpython support to Python recipe module. (Closed)
Patch Set: rebase Created 3 years, 7 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 | « no previous file | recipe_modules/python/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 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
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
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()
OLDNEW
« no previous file with comments | « no previous file | recipe_modules/python/api.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698