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

Side by Side Diff: tools/chrome_proxy/webdriver/common.py

Issue 2909943005: Refactor variations_combinations.py to use testing configs (Closed)
Patch Set: tbansal comments Created 3 years, 6 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 | tools/chrome_proxy/webdriver/variations_combinations.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 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import argparse 5 import argparse
6 import json 6 import json
7 import logging 7 import logging
8 import os 8 import os
9 import re 9 import re
10 import socket 10 import socket
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 return True; 735 return True;
736 return False; 736 return False;
737 737
738 @staticmethod 738 @staticmethod
739 def RunAllTests(run_all_tests=False): 739 def RunAllTests(run_all_tests=False):
740 """A simple helper method to run all tests using unittest.main(). 740 """A simple helper method to run all tests using unittest.main().
741 741
742 Args: 742 Args:
743 run_all_tests: If True, all tests in the directory will be run, Otherwise 743 run_all_tests: If True, all tests in the directory will be run, Otherwise
744 only the tests in the file given on the command line will be run. 744 only the tests in the file given on the command line will be run.
745 Returns:
746 the TestResult object from the test runner
745 """ 747 """
746 flags = ParseFlags() 748 flags = ParseFlags()
747 logger = GetLogger() 749 logger = GetLogger()
748 logger.debug('Command line args: %s', str(sys.argv)) 750 logger.debug('Command line args: %s', str(sys.argv))
749 logger.info('sys.argv parsed to %s', str(flags)) 751 logger.info('sys.argv parsed to %s', str(flags))
750 if flags.catch: 752 if flags.catch:
751 unittest.installHandler() 753 unittest.installHandler()
752 # Use python's test discovery to locate tests files that have subclasses of 754 # Use python's test discovery to locate tests files that have subclasses of
753 # unittest.TestCase and methods beginning with 'test'. 755 # unittest.TestCase and methods beginning with 'test'.
754 pattern = '*.py' if run_all_tests else os.path.basename(sys.argv[0]) 756 pattern = '*.py' if run_all_tests else os.path.basename(sys.argv[0])
755 loader = unittest.TestLoader() 757 loader = unittest.TestLoader()
756 test_suite_iter = loader.discover(os.path.dirname(__file__), 758 test_suite_iter = loader.discover(os.path.dirname(__file__),
757 pattern=pattern) 759 pattern=pattern)
758 # Match class and method name on the given test filter from --test_filter. 760 # Match class and method name on the given test filter from --test_filter.
759 tests = unittest.TestSuite() 761 tests = unittest.TestSuite()
760 test_filter_re = flags.test_filter.replace('.', r'\.').replace('*', '.*') 762 test_filter_re = flags.test_filter.replace('.', r'\.').replace('*', '.*')
761 for test_suite in test_suite_iter: 763 for test_suite in test_suite_iter:
762 for test_case in test_suite: 764 for test_case in test_suite:
763 for test in test_case: 765 for test in test_case:
764 # Drop the file name in the form <filename>.<classname>.<methodname> 766 # Drop the file name in the form <filename>.<classname>.<methodname>
765 test_id = test.id()[test.id().find('.') + 1:] 767 test_id = test.id()[test.id().find('.') + 1:]
766 if re.match(test_filter_re, test_id): 768 if re.match(test_filter_re, test_id):
767 tests.addTest(test) 769 tests.addTest(test)
768 testRunner = unittest.runner.TextTestRunner(verbosity=2, 770 testRunner = unittest.runner.TextTestRunner(verbosity=2,
769 failfast=flags.failfast, buffer=(not flags.disable_buffer)) 771 failfast=flags.failfast, buffer=(not flags.disable_buffer))
770 testRunner.run(tests) 772 return testRunner.run(tests)
OLDNEW
« no previous file with comments | « no previous file | tools/chrome_proxy/webdriver/variations_combinations.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698