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

Side by Side Diff: server/autotest_unittest.py

Issue 6124004: Revert "Merge remote branch 'cros/upstream' into autotest-rebase" (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: Created 9 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « server/autotest.py ('k') | server/base_utils.py » ('j') | 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/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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 def _expect_failed_run(self, command): 249 def _expect_failed_run(self, command):
250 (self.host.run.expect_call(command) 250 (self.host.run.expect_call(command)
251 .and_raises(error.AutoservRunError('dummy', object()))) 251 .and_raises(error.AutoservRunError('dummy', object())))
252 252
253 253
254 def test_get_installed_autodir(self): 254 def test_get_installed_autodir(self):
255 self._stub_get_client_autodir_paths() 255 self._stub_get_client_autodir_paths()
256 self.host.get_autodir.expect_call().and_return(None) 256 self.host.get_autodir.expect_call().and_return(None)
257 self._expect_failed_run('test -x /some/path/bin/autotest') 257 self._expect_failed_run('test -x /some/path/bin/autotest')
258 self.host.run.expect_call('test -x /another/path/bin/autotest') 258 self.host.run.expect_call('test -x /another/path/bin/autotest')
259 self.host.run.expect_call('test -w /another/path')
260 259
261 autodir = autotest.Autotest.get_installed_autodir(self.host) 260 autodir = autotest.Autotest.get_installed_autodir(self.host)
262 self.assertEquals(autodir, '/another/path') 261 self.assertEquals(autodir, '/another/path')
263 262
264 263
265 def test_get_install_dir(self): 264 def test_get_install_dir(self):
266 self._stub_get_client_autodir_paths() 265 self._stub_get_client_autodir_paths()
267 self.host.get_autodir.expect_call().and_return(None) 266 self.host.get_autodir.expect_call().and_return(None)
268 self._expect_failed_run('test -x /some/path/bin/autotest') 267 self._expect_failed_run('test -x /some/path/bin/autotest')
269 self._expect_failed_run('test -x /another/path/bin/autotest') 268 self._expect_failed_run('test -x /another/path/bin/autotest')
270 self._expect_failed_run('mkdir -p /some/path') 269 self._expect_failed_run('mkdir -p /some/path')
271 self.host.run.expect_call('mkdir -p /another/path') 270 self.host.run.expect_call('mkdir -p /another/path')
272 self.host.run.expect_call('test -w /another/path')
273 271
274 install_dir = autotest.Autotest.get_install_dir(self.host) 272 install_dir = autotest.Autotest.get_install_dir(self.host)
275 self.assertEquals(install_dir, '/another/path') 273 self.assertEquals(install_dir, '/another/path')
276 274
277 275
278 def test_client_logger_process_line_log_copy_collection_failure(self): 276 def test_client_logger_process_line_log_copy_collection_failure(self):
279 collector = autotest.log_collector.expect_new(self.host, '', '') 277 collector = autotest.log_collector.expect_new(self.host, '', '')
280 logger = autotest.client_logger(self.host, '', '') 278 logger = autotest.client_logger(self.host, '', '')
281 collector.collect_client_job_results.expect_call().and_raises( 279 collector.collect_client_job_results.expect_call().and_raises(
282 Exception('log copy failure')) 280 Exception('log copy failure'))
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 347
350 348
351 def test_fails_with_exception(self): 349 def test_fails_with_exception(self):
352 self.assertEqual(False, self.mixin.run_test('sleeptest')) 350 self.assertEqual(False, self.mixin.run_test('sleeptest'))
353 self.assert_("job.run_test('sleeptest')\n" in self.control_file) 351 self.assert_("job.run_test('sleeptest')\n" in self.control_file)
354 self.assertEqual(self.mixin, self.host) 352 self.assertEqual(self.mixin, self.host)
355 353
356 354
357 if __name__ == "__main__": 355 if __name__ == "__main__":
358 unittest.main() 356 unittest.main()
OLDNEW
« no previous file with comments | « server/autotest.py ('k') | server/base_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698