[autotest] Fix test_push to find its test build properly
The test_push script depended on `atest stable_version`, which needs
to be deleted. Fix the dependency to use a more stable interface.
BUG=chromium:835447
TEST=unit tests; run a stubbed script on the test instance
Change-Id: I537cc7e056ba9feb6e5d6a284332d5f41b64baa1
Reviewed-on: https://chromium-review.googlesource.com/1022749
Commit-Ready: Richard Barnette <jrbarnette@chromium.org>
Tested-by: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: Congbin Guo <guocb@chromium.org>
diff --git a/site_utils/test_push_unittest.py b/site_utils/test_push_unittest.py
index 80d37b7..960f366 100755
--- a/site_utils/test_push_unittest.py
+++ b/site_utils/test_push_unittest.py
@@ -19,10 +19,15 @@
retry.retry = mock.create_autospec(retry.retry, return_value=lambda func: func)
from autotest_lib.site_utils import test_push
-
class TestPushUnittests(mox.MoxTestBase):
"""Unittest for test_push script."""
+ _ARGV = [
+ 'command',
+ '--build', 'stumpy-release/R36-5881-0.0',
+ '--shard_build', 'quawks-release/R36-5881-0.0'
+ ]
+
def setUp(self):
"""Initialize the unittest."""
super(TestPushUnittests, self).setUp()
@@ -46,12 +51,6 @@
self.mox.StubOutWithMock(urllib2, 'urlopen')
urllib2.urlopen(mox.IgnoreArg()).AndReturn(response)
- self.mox.StubOutWithMock(test_push, 'get_default_build')
- test_push.get_default_build(mox.IgnoreArg(), mox.IgnoreArg()).AndReturn(
- 'stumpy-release/R36-5881-0.0')
- test_push.get_default_build(mox.IgnoreArg(), mox.IgnoreArg()).AndReturn(
- 'quawks-release/R36-5881-0.0')
-
self.mox.StubOutWithMock(test_push, 'check_dut_image')
test_push.check_dut_image(mox.IgnoreArg(), mox.IgnoreArg()).AndReturn(
None)
@@ -75,7 +74,7 @@
self.stub_out_methods(test_views)
self.mox.ReplayAll()
test_push.test_suite(test_push.PUSH_TO_PROD_SUITE, test_views,
- arguments=test_push.parse_arguments())
+ arguments=test_push.parse_arguments(self._ARGV))
self.mox.VerifyAll()
@@ -88,7 +87,7 @@
self.stub_out_methods(test_views)
self.mox.ReplayAll()
test_push.test_suite(test_push.PUSH_TO_PROD_SUITE, test_views,
- arguments=test_push.parse_arguments())
+ arguments=test_push.parse_arguments(self._ARGV))
self.mox.VerifyAll()
@@ -103,7 +102,7 @@
self.stub_out_methods(test_views)
self.mox.ReplayAll()
test_push.test_suite(test_push.PUSH_TO_PROD_SUITE, test_views,
- arguments=test_push.parse_arguments())
+ arguments=test_push.parse_arguments(self._ARGV))
self.mox.VerifyAll()
@@ -118,7 +117,7 @@
self.stub_out_methods(test_views)
self.mox.ReplayAll()
test_push.test_suite(test_push.PUSH_TO_PROD_SUITE, test_views,
- arguments=test_push.parse_arguments())
+ arguments=test_push.parse_arguments(self._ARGV))
self.mox.VerifyAll()