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

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

Issue 2598053002: Create run_all_tests script. (Closed)
Patch Set: Created 4 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
« no previous file with comments | « no previous file | tools/chrome_proxy/webdriver/run_all_tests.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 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 Args: 520 Args:
521 http_response: The HTTPResponse object to check. 521 http_response: The HTTPResponse object to check.
522 """ 522 """
523 expected_via_header = ParseFlags().via_header_value 523 expected_via_header = ParseFlags().via_header_value
524 self.assertNotIn('via', http_response.response_headers) 524 self.assertNotIn('via', http_response.response_headers)
525 if 'via' in http_response.response_headers: 525 if 'via' in http_response.response_headers:
526 self.assertNotIn(expected_via_header, 526 self.assertNotIn(expected_via_header,
527 http_response.response_headers['via']) 527 http_response.response_headers['via'])
528 528
529 @staticmethod 529 @staticmethod
530 def RunAllTests(): 530 def RunAllTests(run_all_tests=False):
531 """A simple helper method to run all tests using unittest.main(). 531 """A simple helper method to run all tests using unittest.main().
532
533 Args:
534 run_all_tests: If True, all tests in the directory will be run, Otherwise
535 only the tests in the file given on the command line will be run.
532 """ 536 """
533 flags = ParseFlags() 537 flags = ParseFlags()
534 logger = GetLogger() 538 logger = GetLogger()
535 logger.debug('Command line args: %s', str(sys.argv)) 539 logger.debug('Command line args: %s', str(sys.argv))
536 logger.info('sys.argv parsed to %s', str(flags)) 540 logger.info('sys.argv parsed to %s', str(flags))
537 # The unittest library uses sys.argv itself and is easily confused by our 541 if flags.catch:
538 # command line options. Pass it a simpler argv instead, while working in the 542 unittest.installHandler()
539 # unittest command line args functionality. 543 pattern = '*.py' if run_all_tests else os.path.basename(sys.argv[0])
540 unittest.main(argv=[sys.argv[0]], verbosity=2, failfast=flags.failfast, 544 loader = unittest.TestLoader()
541 catchbreak=flags.catch, buffer=(not flags.disable_buffer)) 545 tests = loader.discover('.', pattern=pattern)
RyanSturm 2016/12/22 18:40:20 s/'.'/os.path.dirname(__file__)/ or something simi
Robert Ogden 2016/12/22 18:53:00 Done.
546 testRunner = unittest.runner.TextTestRunner(verbosity=2,
547 failfast=flags.failfast, buffer=(not flags.disable_buffer))
548 testRunner.run(tests)
OLDNEW
« no previous file with comments | « no previous file | tools/chrome_proxy/webdriver/run_all_tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698