From ea838d15da20e8e5cf9f78b1bd06728c1607f575 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 8 Dec 2014 11:55:32 -0500 Subject: 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 Reviewed-by: Don Garrett Tested-by: Mike Frysinger Commit-Queue: Mike Frysinger --- cbuildbot/stages/report_stages_unittest.py | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) mode change 100755 => 100644 cbuildbot/stages/report_stages_unittest.py (limited to 'cbuildbot/stages/report_stages_unittest.py') diff --git a/cbuildbot/stages/report_stages_unittest.py b/cbuildbot/stages/report_stages_unittest.py old mode 100755 new mode 100644 index 5bb1a47df..e882daa98 --- a/cbuildbot/stages/report_stages_unittest.py +++ b/cbuildbot/stages/report_stages_unittest.py @@ -1,4 +1,3 @@ -#!/usr/bin/python # Copyright (c) 2012 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,10 +6,9 @@ from __future__ import print_function +import mock import os -import sys -sys.path.insert(0, os.path.abspath('%s/../../..' % os.path.dirname(__file__))) from chromite.cbuildbot import cbuildbot_run from chromite.cbuildbot import commands from chromite.cbuildbot import constants @@ -26,18 +24,12 @@ from chromite.cbuildbot.stages import sync_stages from chromite.cbuildbot.stages import sync_stages_unittest from chromite.lib import alerts from chromite.lib import cidb -from chromite.lib import cros_test_lib from chromite.lib import fake_cidb from chromite.lib import gs from chromite.lib import osutils from chromite.lib import retry_stats from chromite.lib import toolchain -# TODO(build): Finish test wrapper (http://crosbug.com/37517). -# Until then, this has to be after the chromite imports. -import mock - - # pylint: disable=protected-access class BuildReexecutionStageTest(generic_stages_unittest.AbstractStageTest): @@ -288,7 +280,3 @@ class ReportStageNoSyncTest(AbstractReportStageTest): """Check that we can run with a RELEASE_TAG of None.""" self._SetupUpdateStreakCounter() self.RunStage() - - -if __name__ == '__main__': - cros_test_lib.main() -- cgit v1.2.3