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

Side by Side Diff: appengine/findit/waterfall/test/build_failure_analysis_test.py

Issue 2590313002: Added Blame.AddReagions(iterable) method (Closed)
Patch Set: changing Blame.AddRegions to use list.extend 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 | « appengine/findit/util_scripts/git_checkout/test/local_git_repository_test.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 # 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 from datetime import datetime 5 from datetime import datetime
6 6
7 from common.waterfall import failure_type 7 from common.waterfall import failure_type
8 from libs.gitiles.blame import Blame 8 from libs.gitiles.blame import Blame
9 from libs.gitiles.blame import Region 9 from libs.gitiles.blame import Region
10 from libs.gitiles.change_log import FileChangeInfo 10 from libs.gitiles.change_log import FileChangeInfo
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 return MOCK_CHANGE_LOGS.get(revision, MockChangeLog('12', [])) 82 return MOCK_CHANGE_LOGS.get(revision, MockChangeLog('12', []))
83 83
84 def _MockGetCommitsBetweenRevisions(self, start_revision, end_revision): 84 def _MockGetCommitsBetweenRevisions(self, start_revision, end_revision):
85 return map(str, range(int(start_revision) + 1, int(end_revision) + 1)) 85 return map(str, range(int(start_revision) + 1, int(end_revision) + 1))
86 86
87 def _MockGetBlame(self, path, revision): 87 def _MockGetBlame(self, path, revision):
88 if revision == '10' or revision == '11' or path == 'f_not_exist.cc': 88 if revision == '10' or revision == '11' or path == 'f_not_exist.cc':
89 return None 89 return None
90 blame = Blame(revision, path) 90 blame = Blame(revision, path)
91 91
92 blame.AddRegion(Region(1, 2, '7', 92 blame.AddRegions([
93 u'test3@chromium.org', u'test3@chromium.org', 93 Region(1, 2, '7',
94 datetime(2015, 06, 07, 04, 35, 32))) 94 u'test3@chromium.org', u'test3@chromium.org',
95 blame.AddRegion(Region(3, 3, '5', 95 datetime(2015, 06, 07, 04, 35, 32)),
96 u'test3@chromium.org', u'test3@chromium.org', 96 Region(3, 3, '5',
97 datetime(2015, 06, 05, 04, 35, 32))) 97 u'test3@chromium.org', u'test3@chromium.org',
98 blame.AddRegion(Region(7, 1, '8', 98 datetime(2015, 06, 05, 04, 35, 32)),
99 u'test2@chromium.org', u'test2@chromium.org', 99 Region(7, 1, '8',
100 datetime(2015, 06, 8, 04, 35, 32))) 100 u'test2@chromium.org', u'test2@chromium.org',
101 blame.AddRegion(Region(8, 1, '7', 101 datetime(2015, 06, 8, 04, 35, 32)),
102 u'test3@chromium.org', u'test3@chromium.org', 102 Region(8, 1, '7',
103 datetime(2015, 06, 07, 21, 35, 32))) 103 u'test3@chromium.org', u'test3@chromium.org',
104 blame.AddRegion(Region(9, 10, '12', 104 datetime(2015, 06, 07, 21, 35, 32)),
105 u'test3@chromium.org', u'test3@chromium.org', 105 Region(9, 10, '12',
106 datetime(2015, 06, 12, 04, 35, 32))) 106 u'test3@chromium.org', u'test3@chromium.org',
107 datetime(2015, 06, 12, 04, 35, 32))])
107 return blame 108 return blame
108 109
109 def testIsSameFile(self): 110 def testIsSameFile(self):
110 self.assertTrue(build_failure_analysis._IsSameFile('a/b/x.cc', 'x.cc')) 111 self.assertTrue(build_failure_analysis._IsSameFile('a/b/x.cc', 'x.cc'))
111 self.assertTrue(build_failure_analysis._IsSameFile('a/b/x.cc', 'b/x.cc')) 112 self.assertTrue(build_failure_analysis._IsSameFile('a/b/x.cc', 'b/x.cc'))
112 self.assertTrue(build_failure_analysis._IsSameFile('a/b/x.cc', 'a/b/x.cc')) 113 self.assertTrue(build_failure_analysis._IsSameFile('a/b/x.cc', 'a/b/x.cc'))
113 self.assertTrue(build_failure_analysis._IsSameFile('A/B/X.cc', 'a/b/x.cc')) 114 self.assertTrue(build_failure_analysis._IsSameFile('A/B/X.cc', 'a/b/x.cc'))
114 115
115 self.assertFalse( 116 self.assertFalse(
116 build_failure_analysis._IsSameFile('a/prefix_x.cc.', 'x.cc')) 117 build_failure_analysis._IsSameFile('a/prefix_x.cc.', 'x.cc'))
(...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after
1213 touched_file, file_path_in_log, justification, file_name_occurrences, 1214 touched_file, file_path_in_log, justification, file_name_occurrences,
1214 line_numbers, repo_info, commit_revision) 1215 line_numbers, repo_info, commit_revision)
1215 1216
1216 expected_justification = { 1217 expected_justification = {
1217 'score': 4, 1218 'score': 4,
1218 'hints': { 1219 'hints': {
1219 'modified c.cc[1, 3] (and it was in log)': 4 1220 'modified c.cc[1, 3] (and it was in log)': 4
1220 } 1221 }
1221 } 1222 }
1222 self.assertEqual(expected_justification, justification.ToDict()) 1223 self.assertEqual(expected_justification, justification.ToDict())
OLDNEW
« no previous file with comments | « appengine/findit/util_scripts/git_checkout/test/local_git_repository_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698