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

Side by Side Diff: tests/isolate_smoke_test.py

Issue 22902007: Switch trace_inputs.py and isolate.py to subcommand.py. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/swarm_client
Patch Set: Now works Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « isolate.py ('k') | tests/isolate_test.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 (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 import cStringIO 6 import cStringIO
7 import hashlib 7 import hashlib
8 import json 8 import json
9 import logging 9 import logging
10 import os 10 import os
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 # Does not inherit from the other *Base classes. 396 # Does not inherit from the other *Base classes.
397 def test_help_modes(self): 397 def test_help_modes(self):
398 # Check coherency in the help and implemented modes. 398 # Check coherency in the help and implemented modes.
399 p = subprocess.Popen( 399 p = subprocess.Popen(
400 [sys.executable, os.path.join(ROOT_DIR, 'isolate.py'), '--help'], 400 [sys.executable, os.path.join(ROOT_DIR, 'isolate.py'), '--help'],
401 stdout=subprocess.PIPE, 401 stdout=subprocess.PIPE,
402 stderr=subprocess.STDOUT, 402 stderr=subprocess.STDOUT,
403 cwd=ROOT_DIR) 403 cwd=ROOT_DIR)
404 out = p.communicate()[0].splitlines() 404 out = p.communicate()[0].splitlines()
405 self.assertEqual(0, p.returncode) 405 self.assertEqual(0, p.returncode)
406 out = out[out.index('') + 1:] 406 out = out[out.index('Commands are:') + 1:]
407 out = out[:out.index('')] 407 out = out[:out.index('')]
408 modes = [re.match(r'^ (\w+) .+', l) for l in out] 408 regexp = '^ (?:\x1b\\[\\d\\dm)(\\w+)\s*(:?\x1b\\[\\d\\dm) .+'
Vadim Sh. 2013/08/19 17:54:02 err.... what is that? :) looks like write-only reg
M-A Ruel 2013/08/19 20:05:03 ANSI escape code. ESC[\d\dm http://en.wikipedia.or
409 modes = tuple(m.group(1) for m in modes if m) 409 modes = [re.match(regexp, l) for l in out]
410 modes = [m.group(1) for m in modes if m]
410 self.assertEqual(sorted(EXPECTED_MODES), sorted(modes)) 411 self.assertEqual(sorted(EXPECTED_MODES), sorted(modes))
411 412
412 def test_modes(self): 413 def test_modes(self):
413 # This is a bit redundant but make sure all combinations are tested. 414 # This is a bit redundant but make sure all combinations are tested.
414 files = sorted( 415 files = sorted(
415 i[:-len('.isolate')] 416 i[:-len('.isolate')]
416 for i in os.listdir(os.path.join(ROOT_DIR, 'tests', 'isolate')) 417 for i in os.listdir(os.path.join(ROOT_DIR, 'tests', 'isolate'))
417 if i.endswith('.isolate') 418 if i.endswith('.isolate')
418 ) 419 )
419 files.remove('simple') 420 files.remove('simple')
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
1151 self.assertEqual('Simply works.\n', stdout) 1152 self.assertEqual('Simply works.\n', stdout)
1152 self.assertEqual(0, proc.returncode) 1153 self.assertEqual(0, proc.returncode)
1153 1154
1154 1155
1155 if __name__ == '__main__': 1156 if __name__ == '__main__':
1156 VERBOSE = '-v' in sys.argv 1157 VERBOSE = '-v' in sys.argv
1157 logging.basicConfig(level=logging.DEBUG if VERBOSE else logging.ERROR) 1158 logging.basicConfig(level=logging.DEBUG if VERBOSE else logging.ERROR)
1158 if VERBOSE: 1159 if VERBOSE:
1159 unittest.TestCase.maxDiff = None 1160 unittest.TestCase.maxDiff = None
1160 unittest.main() 1161 unittest.main()
OLDNEW
« no previous file with comments | « isolate.py ('k') | tests/isolate_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698