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

Side by Side Diff: build/android/pylib/instrumentation/instrumentation_test_instance.py

Issue 1422433007: Align handling of ParameterizedTest annotations in Java and Python code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments addressed Created 5 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
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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 collections 5 import collections
6 import copy 6 import copy
7 import logging 7 import logging
8 import os 8 import os
9 import pickle 9 import pickle
10 import re 10 import re
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 "--flag-to-add" added to command-line, the second time with 156 "--flag-to-add" added to command-line, the second time with
157 "--flag-to-remove" to be removed from command-line, and the third time 157 "--flag-to-remove" to be removed from command-line, and the third time
158 with default command-line args. If the same flag is listed both for adding 158 with default command-line args. If the same flag is listed both for adding
159 and for removing, it is left unchanged. 159 and for removing, it is left unchanged.
160 160
161 If the test is not parametrized, returns None. 161 If the test is not parametrized, returns None.
162 162
163 """ 163 """
164 ParamsTuple = collections.namedtuple('ParamsTuple', ['add', 'remove']) 164 ParamsTuple = collections.namedtuple('ParamsTuple', ['add', 'remove'])
165 parameterized_tests = [] 165 parameterized_tests = []
166 if _PARAMETERIZED_TEST_ANNOTATION in annotations: 166 if _PARAMETERIZED_TEST_SET_ANNOTATION in annotations:
167 parameterized_tests = [annotations[_PARAMETERIZED_TEST_ANNOTATION]]
168 elif _PARAMETERIZED_TEST_SET_ANNOTATION in annotations:
169 if annotations[_PARAMETERIZED_TEST_SET_ANNOTATION]: 167 if annotations[_PARAMETERIZED_TEST_SET_ANNOTATION]:
170 parameterized_tests = annotations[ 168 parameterized_tests = annotations[
171 _PARAMETERIZED_TEST_SET_ANNOTATION].get('tests', []) 169 _PARAMETERIZED_TEST_SET_ANNOTATION].get('tests', [])
170 elif _PARAMETERIZED_TEST_ANNOTATION in annotations:
171 parameterized_tests = [annotations[_PARAMETERIZED_TEST_ANNOTATION]]
172 else: 172 else:
173 return None 173 return None
174 174
175 result = [] 175 result = []
176 for pt in parameterized_tests: 176 for pt in parameterized_tests:
177 if not pt: 177 if not pt:
178 continue 178 continue
179 for p in pt['parameters']: 179 for p in pt['parameters']:
180 if p['tag'] == _COMMAND_LINE_PARAMETER: 180 if p['tag'] == _COMMAND_LINE_PARAMETER:
181 to_add = [] 181 to_add = []
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 def GenerateTestResults( 615 def GenerateTestResults(
616 result_code, result_bundle, statuses, start_ms, duration_ms): 616 result_code, result_bundle, statuses, start_ms, duration_ms):
617 return GenerateTestResults(result_code, result_bundle, statuses, 617 return GenerateTestResults(result_code, result_bundle, statuses,
618 start_ms, duration_ms) 618 start_ms, duration_ms)
619 619
620 #override 620 #override
621 def TearDown(self): 621 def TearDown(self):
622 if self._isolate_delegate: 622 if self._isolate_delegate:
623 self._isolate_delegate.Clear() 623 self._isolate_delegate.Clear()
624 624
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698