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

Side by Side Diff: tests/subprocess2_test.py

Issue 8694006: Add Popen.start property. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « subprocess2.py ('k') | no next file » | 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 (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Unit tests for subprocess2.py.""" 6 """Unit tests for subprocess2.py."""
7 7
8 import logging 8 import logging
9 import optparse 9 import optparse
10 import os 10 import os
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 if sys.platform != 'win32': 135 if sys.platform != 'win32':
136 env = os.environ.copy() 136 env = os.environ.copy()
137 is_english = lambda name: env.get(name, 'en').startswith('en') 137 is_english = lambda name: env.get(name, 'en').startswith('en')
138 if not is_english('LANG'): 138 if not is_english('LANG'):
139 env['LANG'] = 'en_US.UTF-8' 139 env['LANG'] = 'en_US.UTF-8'
140 expected['env'] = env 140 expected['env'] = env
141 if not is_english('LANGUAGE'): 141 if not is_english('LANGUAGE'):
142 env['LANGUAGE'] = 'en_US.UTF-8' 142 env['LANGUAGE'] = 'en_US.UTF-8'
143 expected['env'] = env 143 expected['env'] = env
144 self.assertEquals(expected, results) 144 self.assertEquals(expected, results)
145 self.assertTrue(time.time() >= proc.start)
145 146
146 def test_check_output_defaults(self): 147 def test_check_output_defaults(self):
147 results = self._fake_communicate() 148 results = self._fake_communicate()
148 # It's discarding 'stderr' because it assumes stderr=subprocess2.STDOUT but 149 # It's discarding 'stderr' because it assumes stderr=subprocess2.STDOUT but
149 # fake_communicate() doesn't 'implement' that. 150 # fake_communicate() doesn't 'implement' that.
150 self.assertEquals('stdout', subprocess2.check_output(['foo'], a=True)) 151 self.assertEquals('stdout', subprocess2.check_output(['foo'], a=True))
151 expected = { 152 expected = {
152 'args': ['foo'], 153 'args': ['foo'],
153 'a':True, 154 'a':True,
154 'stdin': subprocess2.VOID, 155 'stdin': subprocess2.VOID,
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 return options.return_value 379 return options.return_value
379 380
380 381
381 if __name__ == '__main__': 382 if __name__ == '__main__':
382 logging.basicConfig(level= 383 logging.basicConfig(level=
383 [logging.WARNING, logging.INFO, logging.DEBUG][ 384 [logging.WARNING, logging.INFO, logging.DEBUG][
384 min(2, sys.argv.count('-v'))]) 385 min(2, sys.argv.count('-v'))])
385 if len(sys.argv) > 1 and sys.argv[1] == '--child': 386 if len(sys.argv) > 1 and sys.argv[1] == '--child':
386 sys.exit(child_main(sys.argv[2:])) 387 sys.exit(child_main(sys.argv[2:]))
387 unittest.main() 388 unittest.main()
OLDNEW
« no previous file with comments | « subprocess2.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698