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

Side by Side Diff: server/autotest_unittest.py

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

Powered by Google App Engine
This is Rietveld 408576698