image_test: Split into the lib, and the tests
image_test module imports some third party modules. In order for us to
not depend on them at bootstrap time, this CL reorganizes those imports
into an image_test_lib module, and keep only the tests in image_test
module.
BUG=brillo:1158
TEST=unittests
TEST=trybots on release groups
Change-Id: Ia60e74414abf49e8f9f81fbabd28b19d59a0cadf
Reviewed-on: https://chromium-review.googlesource.com/274447
Commit-Queue: Nam Nguyen <namnguyen@chromium.org>
Tested-by: Nam Nguyen <namnguyen@chromium.org>
Trybot-Ready: Nam Nguyen <namnguyen@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
diff --git a/scripts/test_image_unittest.py b/scripts/test_image_unittest.py
index edddd72..ed11825 100644
--- a/scripts/test_image_unittest.py
+++ b/scripts/test_image_unittest.py
@@ -13,7 +13,7 @@
from chromite.cbuildbot import constants
from chromite.lib import cros_build_lib
from chromite.lib import cros_test_lib
-from chromite.lib import image_test
+from chromite.lib import image_test_lib
from chromite.lib import osutils
from chromite.scripts import test_image
@@ -72,7 +72,7 @@
def testChdir(self):
"""Verify the CWD is in a temp directory."""
- class CwdTest(image_test.NonForgivingImageTestCase):
+ class CwdTest(image_test_lib.NonForgivingImageTestCase):
"""A dummy test class to verify current working directory."""
_expected_dir = None
@@ -87,7 +87,7 @@
os.chdir('/tmp')
test = CwdTest('testExpectedCwd')
- suite = image_test.ImageTestSuite()
+ suite = image_test_lib.ImageTestSuite()
suite.addTest(test)
self.PatchObject(unittest.TestLoader, 'loadTestsFromName', autospec=True,
return_value=[suite])
@@ -105,7 +105,7 @@
def _testForgiveness(self, forgiveness, expected_result):
- class ForgivenessTest(image_test.ImageTestCase):
+ class ForgivenessTest(image_test_lib.ImageTestCase):
"""A dummy test that is sometime forgiving, sometime not.
Its only test (testFail) always fail.
@@ -124,7 +124,7 @@
test = ForgivenessTest('testFail')
test.SetForgiving(forgiveness)
- suite = image_test.ImageTestSuite()
+ suite = image_test_lib.ImageTestSuite()
suite.addTest(test)
self.PatchObject(unittest.TestLoader, 'loadTestsFromName', autospec=True,
return_value=[suite])
@@ -140,14 +140,14 @@
def testBoardAndDirectory(self):
"""Verify that "--board", "--test_results_root" are passed to the tests."""
- class AttributeTest(image_test.ForgivingImageTestCase):
+ class AttributeTest(image_test_lib.ForgivingImageTestCase):
"""Dummy test class to hold board and directory."""
def testOkay(self):
pass
test = AttributeTest('testOkay')
- suite = image_test.ImageTestSuite()
+ suite = image_test_lib.ImageTestSuite()
suite.addTest(test)
self.PatchObject(unittest.TestLoader, 'loadTestsFromName', autospec=True,
return_value=[suite])