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

Side by Side Diff: tools_webrtc/autoroller/unittests/roll_deps_test.py

Issue 2989603002: Fix autoroller in accordance to upstream change (Closed)
Patch Set: Add unittest Created 3 years, 4 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 | « tools_webrtc/autoroller/roll_deps.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 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 # Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 # 3 #
4 # Use of this source code is governed by a BSD-style license 4 # Use of this source code is governed by a BSD-style license
5 # that can be found in the LICENSE file in the root of the source 5 # that can be found in the LICENSE file in the root of the source
6 # tree. An additional intellectual property rights grant can be found 6 # tree. An additional intellectual property rights grant can be found
7 # in the file PATENTS. All contributing project authors may 7 # in the file PATENTS. All contributing project authors may
8 # be found in the AUTHORS file in the root of the source tree. 8 # be found in the AUTHORS file in the root of the source tree.
9 9
10 import glob 10 import glob
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 self.fake = FakeCmd() 76 self.fake = FakeCmd()
77 self.old_run_command = getattr(roll_deps, '_RunCommand') 77 self.old_run_command = getattr(roll_deps, '_RunCommand')
78 setattr(roll_deps, '_RunCommand', self.fake) 78 setattr(roll_deps, '_RunCommand', self.fake)
79 79
80 def tearDown(self): 80 def tearDown(self):
81 shutil.rmtree(self._output_dir, ignore_errors=True) 81 shutil.rmtree(self._output_dir, ignore_errors=True)
82 self.assertEqual(self.fake.expectations, []) 82 self.assertEqual(self.fake.expectations, [])
83 setattr(roll_deps, '_RunCommand', self.old_run_command) 83 setattr(roll_deps, '_RunCommand', self.old_run_command)
84 84
85 def testVarLookup(self):
86 local_scope = {'foo': 'wrong', 'vars': {'foo': 'bar'}}
87 lookup = roll_deps.VarLookup(local_scope)
88 self.assertEquals(lookup('foo'), 'bar')
89
85 def testUpdateDepsFile(self): 90 def testUpdateDepsFile(self):
86 new_rev = 'aaaaabbbbbcccccdddddeeeeefffff0000011111' 91 new_rev = 'aaaaabbbbbcccccdddddeeeeefffff0000011111'
87 92
88 current_rev = TEST_DATA_VARS['chromium_revision'] 93 current_rev = TEST_DATA_VARS['chromium_revision']
89 UpdateDepsFile(self._webrtc_depsfile, current_rev, new_rev, []) 94 UpdateDepsFile(self._webrtc_depsfile, current_rev, new_rev, [])
90 with open(self._webrtc_depsfile) as deps_file: 95 with open(self._webrtc_depsfile) as deps_file:
91 deps_contents = deps_file.read() 96 deps_contents = deps_file.read()
92 self.assertTrue(new_rev in deps_contents, 97 self.assertTrue(new_rev in deps_contents,
93 'Failed to find %s in\n%s' % (new_rev, deps_contents)) 98 'Failed to find %s in\n%s' % (new_rev, deps_contents))
94 99
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 self.assertEquals(changed_deps[1].new_rev, BUILDTOOLS_NEW_REV) 140 self.assertEquals(changed_deps[1].new_rev, BUILDTOOLS_NEW_REV)
136 141
137 142
138 def _SetupGitLsRemoteCall(cmd_fake, url, revision): 143 def _SetupGitLsRemoteCall(cmd_fake, url, revision):
139 cmd = ['git', 'ls-remote', url, revision] 144 cmd = ['git', 'ls-remote', url, revision]
140 cmd_fake.AddExpectation(cmd, _returns=(revision, None)) 145 cmd_fake.AddExpectation(cmd, _returns=(revision, None))
141 146
142 147
143 if __name__ == '__main__': 148 if __name__ == '__main__':
144 unittest.main() 149 unittest.main()
OLDNEW
« no previous file with comments | « tools_webrtc/autoroller/roll_deps.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698