diff options
author | Mike Frysinger <vapier@chromium.org> | 2014-12-08 11:55:32 -0500 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-01-21 11:49:26 +0000 |
commit | ea838d15da20e8e5cf9f78b1bd06728c1607f575 (patch) | |
tree | 04489251c775a91ef1923a4a5488a6cc41c7235a /cbuildbot/cbuildbot_run_unittest.py | |
parent | 27f1347d05b31d7b61462c3c469eea0ec5f7a386 (diff) | |
download | chromite-ea838d15da20e8e5cf9f78b1bd06728c1607f575.tar.gz |
unittests: cut over to the new wrapper
Now that we have a wrapper to deal with the namespace munging, we can
clean up all our unittests. This means:
- add a wrapper symlink for all the unittests
- drop the +x bits on the direct .py file
- drop the shebang on the direct .py file
- delete the manual sys.path munging
- move the mock import to the common system import path
- delete unused os/sys imports
- delete most manual calls to cros_test_lib.main
- add a main() for the few complicated cros_test_lib.main calls
BUG=chromium:219660
TEST=ran all the unittests
Change-Id: I85614c301e48c86a0ca4201c2b60349d2d488e52
Reviewed-on: https://chromium-review.googlesource.com/233832
Reviewed-by: David James <davidjames@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Diffstat (limited to 'cbuildbot/cbuildbot_run_unittest.py')
-rw-r--r--[-rwxr-xr-x] | cbuildbot/cbuildbot_run_unittest.py | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/cbuildbot/cbuildbot_run_unittest.py b/cbuildbot/cbuildbot_run_unittest.py index aa8c322c8..573abb809 100755..100644 --- a/cbuildbot/cbuildbot_run_unittest.py +++ b/cbuildbot/cbuildbot_run_unittest.py @@ -1,4 +1,3 @@ -#!/usr/bin/python # Copyright (c) 2013 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -7,19 +6,16 @@ from __future__ import print_function -import logging -import os import cPickle -import sys +import os +import mock import time -sys.path.insert(0, os.path.abspath('%s/../..' % os.path.dirname(__file__))) from chromite.cbuildbot import cbuildbot_config from chromite.cbuildbot import cbuildbot_run from chromite.lib import cros_test_lib from chromite.lib import parallel -import mock DEFAULT_ARCHIVE_GS_PATH = 'bogus_bucket/TheArchiveBase' DEFAULT_ARCHIVE_BASE = 'gs://%s' % DEFAULT_ARCHIVE_GS_PATH @@ -349,8 +345,9 @@ class GetVersionTest(_BuilderRunTestCase): def testGetVersionInfo(self): verinfo = object() - with mock.patch('cbuildbot_run.manifest_version.VersionInfo.from_repo', - return_value=verinfo) as m: + target = ('chromite.cbuildbot.cbuildbot_run.manifest_version.' + 'VersionInfo.from_repo') + with mock.patch(target, return_value=verinfo) as m: result = cbuildbot_run._BuilderRunBase.GetVersionInfo(DEFAULT_BUILDROOT) self.assertEquals(result, verinfo) @@ -644,7 +641,3 @@ class BoardRunAttributesTest(_BuilderRunTestCase): """Test that regular attributes are not known to BoardRunAttributes.""" self.assertRaises(AttributeError, getattr, self.bra, 'release_tag') self.assertRaises(AttributeError, setattr, self.bra, 'release_tag', 'foo') - - -if __name__ == '__main__': - cros_test_lib.main(level=logging.DEBUG) |