OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 __author__ = "raphtee@google.com (Travis Miller)" | 3 __author__ = "raphtee@google.com (Travis Miller)" |
4 | 4 |
5 import unittest, os, tempfile, logging | 5 import unittest, os, tempfile, logging |
6 | 6 |
7 import common | 7 import common |
8 from autotest_lib.server import autotest, utils, hosts, server_job, profilers | 8 from autotest_lib.server import autotest, utils, hosts, server_job, profilers |
9 from autotest_lib.client.bin import sysinfo | 9 from autotest_lib.client.bin import sysinfo |
10 from autotest_lib.client.common_lib import utils as client_utils, packages | 10 from autotest_lib.client.common_lib import utils as client_utils, packages |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 run_obj.remote_control_file + '.state', | 198 run_obj.remote_control_file + '.state', |
199 run_obj.manual_control_file, | 199 run_obj.manual_control_file, |
200 run_obj.manual_control_file + '.state'] | 200 run_obj.manual_control_file + '.state'] |
201 cmd = ';'.join('rm -f ' + control for control in delete_file_list) | 201 cmd = ';'.join('rm -f ' + control for control in delete_file_list) |
202 self.host.run.expect_call(cmd, ignore_status=True) | 202 self.host.run.expect_call(cmd, ignore_status=True) |
203 | 203 |
204 utils.get.expect_call(control).and_return("temp") | 204 utils.get.expect_call(control).and_return("temp") |
205 | 205 |
206 c = autotest.global_config.global_config | 206 c = autotest.global_config.global_config |
207 c.get_config_value.expect_call("PACKAGES", | 207 c.get_config_value.expect_call("PACKAGES", |
208 'fetch_location', type=list).and_return(['repo']) | 208 'fetch_location', type=list, default=[]).and_return(['repo']) |
209 pkgmgr = packages.PackageManager.expect_new('autotest', | 209 pkgmgr = packages.PackageManager.expect_new('autotest', |
210 repo_urls=['repo'], | 210 repo_urls=['repo'], |
211 hostname='hostname') | 211 hostname='hostname') |
212 | 212 |
213 cfile = self.god.create_mock_class(file, "file") | 213 cfile = self.god.create_mock_class(file, "file") |
214 cfile_orig = "original control file" | 214 cfile_orig = "original control file" |
215 cfile_new = "args = []\njob.add_repository(['repo'])\n" | 215 cfile_new = "args = []\njob.add_repository(['repo'])\n" |
216 cfile_new += cfile_orig | 216 cfile_new += cfile_orig |
217 | 217 |
218 autotest.open.expect_call("temp").and_return(cfile) | 218 autotest.open.expect_call("temp").and_return(cfile) |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 | 349 |
350 | 350 |
351 def test_fails_with_exception(self): | 351 def test_fails_with_exception(self): |
352 self.assertEqual(False, self.mixin.run_test('sleeptest')) | 352 self.assertEqual(False, self.mixin.run_test('sleeptest')) |
353 self.assert_("job.run_test('sleeptest')\n" in self.control_file) | 353 self.assert_("job.run_test('sleeptest')\n" in self.control_file) |
354 self.assertEqual(self.mixin, self.host) | 354 self.assertEqual(self.mixin, self.host) |
355 | 355 |
356 | 356 |
357 if __name__ == "__main__": | 357 if __name__ == "__main__": |
358 unittest.main() | 358 unittest.main() |
OLD | NEW |