OLD | NEW |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 """Unit tests for cros_mark_as_stable.py.""" | 7 """Unit tests for cros_mark_as_stable.py.""" |
8 | 8 |
9 | 9 |
10 import mox | 10 import mox |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
154 self.revved_ebuild_path = '/path/test_package-0.0.1-r2.ebuild' | 154 self.revved_ebuild_path = '/path/test_package-0.0.1-r2.ebuild' |
155 | 155 |
156 def testRevEBuild(self): | 156 def testRevEBuild(self): |
157 self.mox.StubOutWithMock(cros_mark_as_stable.fileinput, 'input') | 157 self.mox.StubOutWithMock(cros_mark_as_stable.fileinput, 'input') |
158 self.mox.StubOutWithMock(cros_mark_as_stable.shutil, 'copyfile') | 158 self.mox.StubOutWithMock(cros_mark_as_stable.shutil, 'copyfile') |
159 m_file = self.mox.CreateMock(file) | 159 m_file = self.mox.CreateMock(file) |
160 | 160 |
161 # Prepare mock fileinput. This tests to make sure both the commit id | 161 # Prepare mock fileinput. This tests to make sure both the commit id |
162 # and keywords are changed correctly. | 162 # and keywords are changed correctly. |
163 mock_file = ['EAPI=2', 'CROS_WORKON_COMMIT=old_id', | 163 mock_file = ['EAPI=2', 'CROS_WORKON_COMMIT=old_id', |
164 'KEYWORDS=\"~x86 ~arm\"', 'src_unpack(){}'] | 164 'KEYWORDS=\"~x86 ~arm\"', 'src_unpack(){}'] |
davidjames
2010/07/31 00:03:32
These lines should have newlines at the end
| |
165 | 165 |
166 cros_mark_as_stable.shutil.copyfile( | 166 cros_mark_as_stable.shutil.copyfile( |
167 self.m_ebuild.ebuild_path_no_version + '-9999.ebuild', | 167 self.m_ebuild.ebuild_path_no_version + '-9999.ebuild', |
168 self.revved_ebuild_path) | 168 self.revved_ebuild_path) |
169 cros_mark_as_stable.fileinput.input(self.revved_ebuild_path, | 169 cros_mark_as_stable.fileinput.input(self.revved_ebuild_path, |
170 inplace=1).AndReturn(mock_file) | 170 inplace=1).AndReturn(mock_file) |
171 m_file.write('EAPI=2') | 171 m_file.write('EAPI=2') |
davidjames
2010/07/31 00:03:32
Same here. Although this isn't a real file, output
| |
172 m_file.write('CROS_WORKON_COMMIT="my_id"') | 172 m_file.write('CROS_WORKON_COMMIT="my_id"\n') |
173 m_file.write('KEYWORDS="x86 arm"') | 173 m_file.write('KEYWORDS="x86 arm"') |
174 m_file.write('src_unpack(){}') | 174 m_file.write('src_unpack(){}') |
175 cros_mark_as_stable._RunCommand('git add ' + self.revved_ebuild_path) | 175 cros_mark_as_stable._RunCommand('git add ' + self.revved_ebuild_path) |
176 cros_mark_as_stable._RunCommand('git rm ' + self.m_ebuild.ebuild_path) | 176 cros_mark_as_stable._RunCommand('git rm ' + self.m_ebuild.ebuild_path) |
177 | 177 |
178 self.mox.ReplayAll() | 178 self.mox.ReplayAll() |
179 marker = cros_mark_as_stable.EBuildStableMarker(self.m_ebuild) | 179 marker = cros_mark_as_stable.EBuildStableMarker(self.m_ebuild) |
180 marker.RevEBuild('my_id', redirect_file=m_file) | 180 marker.RevEBuild('my_id', redirect_file=m_file) |
181 self.mox.VerifyAll() | 181 self.mox.VerifyAll() |
182 | 182 |
(...skipping 11 matching lines...) Expand all Loading... | |
194 #cros_mark_as_stable._RunCommand('git push') | 194 #cros_mark_as_stable._RunCommand('git push') |
195 #self.mox.ReplayAll() | 195 #self.mox.ReplayAll() |
196 #marker = cros_mark_as_stable.EBuildStableMarker(self.m_ebuild) | 196 #marker = cros_mark_as_stable.EBuildStableMarker(self.m_ebuild) |
197 #marker.PushChange() | 197 #marker.PushChange() |
198 #self.mox.VerifyAll() | 198 #self.mox.VerifyAll() |
199 pass | 199 pass |
200 | 200 |
201 | 201 |
202 if __name__ == '__main__': | 202 if __name__ == '__main__': |
203 unittest.main() | 203 unittest.main() |
OLD | NEW |