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

Side by Side Diff: experimental/bisect_lib/chromium_revisions_test.py

Issue 1521503002: Update bisect_lib with the changes committed in the infra/build repo. (Closed) Base URL: https://github.com/catapult-project/catapult.git@master
Patch Set: In README: add back license header, add link to Telemetry docs in catapult Created 5 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 | « experimental/bisect_lib/chromium_revisions.py ('k') | experimental/bisect_lib/depot_map.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 # found in the LICENSE file.
4
5 import os
6 import sys
7 import unittest
8
9 _EXPERIMENTAL = os.path.join(os.path.dirname(__file__), os.pardir)
10 _CATAPULT = os.path.join(_EXPERIMENTAL, os.pardir)
11
12 # TODO(robertocn): Add these to sys.path conditionally.
13 sys.path.append(os.path.join(_CATAPULT, 'third_party', 'mock'))
14 sys.path.append(_EXPERIMENTAL)
15
16 import mock
17
18 from bisect_lib import chromium_revisions
19
20
21 FIRST_REVISION = '53fc07eb478520a80af6bf8b62be259bb55db0f1'
22 LAST_REVISION = 'c89130e28fd01062104e1be7f3a6fc3abbb80ca9'
23
24 TEST_DATA_LOCATION = os.path.join(os.path.dirname(__file__),
25 'test_data')
26 MOCK_INFO_RESPONSE_FILE = open(os.path.join(
27 TEST_DATA_LOCATION, 'MOCK_INFO_RESPONSE_FILE'))
28 MOCK_RANGE_RESPONSE_FILE = open(os.path.join(
29 TEST_DATA_LOCATION, 'MOCK_RANGE_RESPONSE_FILE'))
30
31 EXPECTED_INFO = {
32 'body':
33 'BUG=548160',
34 'date':
35 'Tue Oct 27 21:26:30 2015',
36 'subject':
37 '[Extensions] Fix hiding browser actions without the toolbar redesign',
38 'email':
39 'rdevlin.cronin@chromium.org',
40 'author':
41 'rdevlin.cronin'
42 }
43
44 INTERVENING_REVISIONS = [
45 '2e93263dc74f0496100435e1fd7232e9e8323af0',
46 '6feaa73a54d0515ad2940709161ca0a5ad91d1f8',
47 '3861789af25e2d3502f0fb7080da5785d31308aa',
48 '8fcc8af20a3d41b0512e3b1486e4dc7de528a72b',
49 'f1c777e3f97a16cc6a3aa922a23602fa59412989',
50 'ee261f306c3c66e96339aa1026d62a6d953302fe',
51 '7bd1741893bd4e233b5562a6926d7e395d558343',
52 '4f81be50501fbc02d7e44df0d56032e5885e19b6',
53 '8414732168a8867a5d6bd45eaade68a5820a9e34',
54 '01542ac6d0fbec6aa78e33e6c7ec49a582072ea9',
55 '66aeb2b7084850d09f3fccc7d7467b57e4da1882',
56 '48c1471f1f503246dd66753a4c7588d77282d2df',
57 '84f6037e951c21a3b00bd3ddd034f258da6839b5',
58 'ebd5f102ee89a4be5c98815c02c444fbf2b6b040',
59 '5dbc149bebecea186b693b3d780b6965eeffed0f',
60 '22e49fb496d6ffa122c470f6071d47ccb4ccb672',
61 '07a6d9854efab6677b880defa924758334cfd47d',
62 '32ce3b13924d84004a3e05c35942626cbe93cbbd',
63 ]
64
65
66 class ChromiumRevisionsTest(unittest.TestCase):
67
68 def setUp(self):
69 pass
70
71 def tearDown(self):
72 pass
73
74 def testRevisionInfo(self):
75 with mock.patch('urllib2.urlopen', mock.MagicMock(
76 return_value=MOCK_INFO_RESPONSE_FILE)):
77 test_info = chromium_revisions.revision_info(LAST_REVISION)
78 for key in EXPECTED_INFO:
79 self.assertIn(EXPECTED_INFO[key], test_info[key])
80
81 def testRevisionRange(self):
82 with mock.patch('urllib2.urlopen', mock.MagicMock(
83 return_value=MOCK_RANGE_RESPONSE_FILE)):
84 rev_list = chromium_revisions.revision_range(
85 FIRST_REVISION, LAST_REVISION)
86 commits_only = [entry['commit'] for entry in rev_list]
87 for r in INTERVENING_REVISIONS:
88 self.assertIn(r, commits_only)
89 self.assertIn(LAST_REVISION, commits_only)
90 self.assertEqual(len(INTERVENING_REVISIONS) + 1,
91 len(rev_list))
92
93 if __name__ == '__main__':
94 unittest.main()
95
OLDNEW
« no previous file with comments | « experimental/bisect_lib/chromium_revisions.py ('k') | experimental/bisect_lib/depot_map.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698