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

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

Issue 2095013002: [Android] Fix feature annotation filtering for instrumentation tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 | build/android/pylib/instrumentation/instrumentation_test_instance_test.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 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 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 if not self._annotations: 581 if not self._annotations:
582 return True 582 return True
583 return any_annotation_matches(self._annotations, all_annotations) 583 return any_annotation_matches(self._annotations, all_annotations)
584 584
585 def excluded_annotation_filter(all_annotations): 585 def excluded_annotation_filter(all_annotations):
586 if not self._excluded_annotations: 586 if not self._excluded_annotations:
587 return True 587 return True
588 return not any_annotation_matches(self._excluded_annotations, 588 return not any_annotation_matches(self._excluded_annotations,
589 all_annotations) 589 all_annotations)
590 590
591 def any_annotation_matches(annotations, all_annotations): 591 def any_annotation_matches(filter_annotations, all_annotations):
592 return any( 592 return any(
593 ak in all_annotations and (av is None or av == all_annotations[ak]) 593 ak in all_annotations
rnephew (Reviews Here) 2016/06/24 14:22:43 These variables could probably be a little more de
jbudorick 2016/06/24 14:24:56 In a comprehension, I'd strongly prefer keeping th
594 for ak, av in annotations.iteritems()) 594 and annotation_value_matches(av, all_annotations[ak])
595 for ak, av in filter_annotations.iteritems())
596
597 def annotation_value_matches(filter_av, av):
598 if filter_av is None:
599 return True
600 elif isinstance(av, dict):
601 return filter_av in av['value']
602 elif isinstance(av, list):
603 return filter_av in av
604 return filter_av == av
595 605
596 filtered_classes = [] 606 filtered_classes = []
597 for c in tests: 607 for c in tests:
598 filtered_methods = [] 608 filtered_methods = []
599 for m in c['methods']: 609 for m in c['methods']:
600 # Gtest filtering 610 # Gtest filtering
601 if not gtest_filter(c, m): 611 if not gtest_filter(c, m):
602 continue 612 continue
603 613
604 all_annotations = dict(c['annotations']) 614 all_annotations = dict(c['annotations'])
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 def GenerateTestResults( 681 def GenerateTestResults(
672 result_code, result_bundle, statuses, start_ms, duration_ms): 682 result_code, result_bundle, statuses, start_ms, duration_ms):
673 return GenerateTestResults(result_code, result_bundle, statuses, 683 return GenerateTestResults(result_code, result_bundle, statuses,
674 start_ms, duration_ms) 684 start_ms, duration_ms)
675 685
676 #override 686 #override
677 def TearDown(self): 687 def TearDown(self):
678 if self._isolate_delegate: 688 if self._isolate_delegate:
679 self._isolate_delegate.Clear() 689 self._isolate_delegate.Clear()
680 690
OLDNEW
« no previous file with comments | « no previous file | build/android/pylib/instrumentation/instrumentation_test_instance_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698