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

Side by Side Diff: build/android/pylib/host_driven/test_runner.py

Issue 1315743004: [Android] Add a custom pylintrc for build/android/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix appurify_sanitized import-errors Created 5 years, 3 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
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 """Runs host-driven tests on a particular device.""" 5 """Runs host-driven tests on a particular device."""
6 6
7 import logging 7 import logging
8 import sys 8 import sys
9 import time 9 import time
10 import traceback 10 import traceback
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 and, in the case of a failure, the test that should be retried. 80 and, in the case of a failure, the test that should be retried.
81 """ 81 """
82 82
83 assert isinstance(test, test_case.HostDrivenTestCase) 83 assert isinstance(test, test_case.HostDrivenTestCase)
84 84
85 start_date_ms = int(time.time()) * 1000 85 start_date_ms = int(time.time()) * 1000
86 exception_raised = False 86 exception_raised = False
87 87
88 try: 88 try:
89 test.SetUp(self.device, self.shard_index) 89 test.SetUp(self.device, self.shard_index)
90 except Exception: 90 except Exception: # pylint: disable=broad-except
91 logging.exception( 91 logging.exception(
92 'Caught exception while trying to run SetUp() for test: ' + 92 'Caught exception while trying to run SetUp() for test: ' +
93 test.tagged_name) 93 test.tagged_name)
94 # Tests whose SetUp() method has failed are likely to fail, or at least 94 # Tests whose SetUp() method has failed are likely to fail, or at least
95 # yield invalid results. 95 # yield invalid results.
96 exc_info = sys.exc_info() 96 exc_info = sys.exc_info()
97 results = base_test_result.TestRunResults() 97 results = base_test_result.TestRunResults()
98 results.AddResult(HostDrivenExceptionTestResult( 98 results.AddResult(HostDrivenExceptionTestResult(
99 test.tagged_name, start_date_ms, exc_info)) 99 test.tagged_name, start_date_ms, exc_info))
100 return results, test 100 return results, test
101 101
102 try: 102 try:
103 results = test.Run() 103 results = test.Run()
104 except Exception: 104 except Exception: # pylint: disable=broad-except
105 # Setting this lets TearDown() avoid stomping on our stack trace from 105 # Setting this lets TearDown() avoid stomping on our stack trace from
106 # Run() should TearDown() also raise an exception. 106 # Run() should TearDown() also raise an exception.
107 exception_raised = True 107 exception_raised = True
108 logging.exception('Caught exception while trying to run test: ' + 108 logging.exception('Caught exception while trying to run test: ' +
109 test.tagged_name) 109 test.tagged_name)
110 exc_info = sys.exc_info() 110 exc_info = sys.exc_info()
111 results = base_test_result.TestRunResults() 111 results = base_test_result.TestRunResults()
112 results.AddResult(HostDrivenExceptionTestResult( 112 results.AddResult(HostDrivenExceptionTestResult(
113 test.tagged_name, start_date_ms, exc_info)) 113 test.tagged_name, start_date_ms, exc_info))
114 114
115 try: 115 try:
116 test.TearDown() 116 test.TearDown()
117 except Exception: 117 except Exception: # pylint: disable=broad-except
118 logging.exception( 118 logging.exception(
119 'Caught exception while trying run TearDown() for test: ' + 119 'Caught exception while trying run TearDown() for test: ' +
120 test.tagged_name) 120 test.tagged_name)
121 if not exception_raised: 121 if not exception_raised:
122 # Don't stomp the error during the test if TearDown blows up. This is a 122 # Don't stomp the error during the test if TearDown blows up. This is a
123 # trade-off: if the test fails, this will mask any problem with TearDown 123 # trade-off: if the test fails, this will mask any problem with TearDown
124 # until the test is fixed. 124 # until the test is fixed.
125 exc_info = sys.exc_info() 125 exc_info = sys.exc_info()
126 results = base_test_result.TestRunResults() 126 results = base_test_result.TestRunResults()
127 results.AddResult(HostDrivenExceptionTestResult( 127 results.AddResult(HostDrivenExceptionTestResult(
128 test.tagged_name, start_date_ms, exc_info)) 128 test.tagged_name, start_date_ms, exc_info))
129 129
130 if not results.DidRunPass(): 130 if not results.DidRunPass():
131 return results, test 131 return results, test
132 else: 132 else:
133 return results, None 133 return results, None
OLDNEW
« no previous file with comments | « build/android/pylib/host_driven/test_case.py ('k') | build/android/pylib/host_driven/test_server.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698