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

Side by Side Diff: tools/auto_bisect/run_tests

Issue 660393002: Refactoring the output of bisect script. Switching from plain printing to a combination of: (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Applying recommendations Created 6 years, 1 month 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 | « tools/auto_bisect/bisect_perf_regression.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 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 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 """Runs all tests in all unit test modules in this directory.""" 6 """Runs all tests in all unit test modules in this directory."""
7 7
8 import os 8 import os
9 import sys 9 import sys
10 import unittest 10 import unittest
11 import logging
11 12
12 SRC = os.path.join(os.path.dirname(__file__), os.path.pardir, os.path.pardir) 13 SRC = os.path.join(os.path.dirname(__file__), os.path.pardir, os.path.pardir)
13 14
14 15
15 def main(): 16 def main():
17 if 'full-log' in sys.argv:
18 # Configure logging to show line numbers and logging level
19 fmt = '%(module)s:%(lineno)d - %(levelname)s: %(message)s'
20 logging.basicConfig(level=logging.DEBUG, stream=sys.stdout, format=fmt)
21 elif 'no-log' in sys.argv:
22 # Only WARN and above are shown, to standard error. (This is the logging
23 # module default config, hence we do nothing here)
24 pass
25 else:
26 # Behave as before. Make logging.info mimic print behavior
27 fmt = '%(message)s'
28 logging.basicConfig(level=logging.INFO, stream=sys.stdout, format=fmt)
29
16 # Running the tests depends on having the below modules in PYTHONPATH. 30 # Running the tests depends on having the below modules in PYTHONPATH.
17 sys.path.append(os.path.join(SRC, 'tools', 'telemetry')) 31 sys.path.append(os.path.join(SRC, 'tools', 'telemetry'))
18 sys.path.append(os.path.join(SRC, 'third_party', 'pymock')) 32 sys.path.append(os.path.join(SRC, 'third_party', 'pymock'))
19 33
20 suite = unittest.TestSuite() 34 suite = unittest.TestSuite()
21 loader = unittest.TestLoader() 35 loader = unittest.TestLoader()
22 script_dir = os.path.dirname(__file__) 36 script_dir = os.path.dirname(__file__)
23 suite.addTests(loader.discover(start_dir=script_dir, pattern='*_test.py')) 37 suite.addTests(loader.discover(start_dir=script_dir, pattern='*_test.py'))
24 38
25 print 'Running unit tests in %s...' % os.path.abspath(script_dir) 39 print 'Running unit tests in %s...' % os.path.abspath(script_dir)
26 result = unittest.TextTestRunner(verbosity=1).run(suite) 40 result = unittest.TextTestRunner(verbosity=1).run(suite)
27 return 0 if result.wasSuccessful() else 1 41 return 0 if result.wasSuccessful() else 1
28 42
29 43
30 if __name__ == '__main__': 44 if __name__ == '__main__':
31 sys.exit(main()) 45 sys.exit(main())
OLDNEW
« no previous file with comments | « tools/auto_bisect/bisect_perf_regression.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698