From patchwork Wed Aug 7 09:47:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Milo Casagrande X-Patchwork-Id: 18826 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ye0-f199.google.com (mail-ye0-f199.google.com [209.85.213.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 421B0246B3 for ; Wed, 7 Aug 2013 09:47:28 +0000 (UTC) Received: by mail-ye0-f199.google.com with SMTP id l12sf1729316yen.10 for ; Wed, 07 Aug 2013 02:47:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:delivered-to:mime-version:to:from:subject :message-id:date:reply-to:sender:errors-to:precedence :x-original-sender:x-original-authentication-results:mailing-list :list-id:list-post:list-help:list-archive:list-unsubscribe :content-type; bh=IPrVWdkfjcUkf3umbtmbirlJKf9vaVQ+g9OgIkN0DK8=; b=oc/ZXctLgIMBCxJmjPASTnD0Jib2PRfX6iU7PwYjz9fPLUDY/gYeQ64+ynJBP42ZLJ P9woWhzgGB2bW4qwNd4dA4WSA9bwrmCGbSPclGd0TbVf10B+7OTu07LSvjtHwiV/TxmW zod0cT74JJzCBFH8/kObDLBnPeBhXIBmPUpRERYNgCLdlEuEJPmtg30nLyQ2ETRPJz+e /VMvBNfe13lGQJF4tTWO+efPfMPnVKfp0Qb2fEjtlfIFWOTaGKU4L7sRLofy3R0G8SP8 o2eAX41kGVKE51rjQKIzxJmTgtJxQnCFoKAi+yNhXRmexyKL81lXhbcdnQfeWFZJbpoy pY/Q== X-Received: by 10.236.70.105 with SMTP id o69mr1027806yhd.53.1375868848083; Wed, 07 Aug 2013 02:47:28 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.70.228 with SMTP id p4ls609267qeu.43.gmail; Wed, 07 Aug 2013 02:47:27 -0700 (PDT) X-Received: by 10.58.188.52 with SMTP id fx20mr717173vec.47.1375868847910; Wed, 07 Aug 2013 02:47:27 -0700 (PDT) Received: from mail-ve0-f174.google.com (mail-ve0-f174.google.com [209.85.128.174]) by mx.google.com with ESMTPS id to9si1357458vdc.32.2013.08.07.02.47.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 07 Aug 2013 02:47:27 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.174; Received: by mail-ve0-f174.google.com with SMTP id d10so1542759vea.33 for ; Wed, 07 Aug 2013 02:47:27 -0700 (PDT) X-Gm-Message-State: ALoCoQkS5ZvCYDMnEaEbp53Gjg2iN/C0R+VVlf+TWuKeL4ND09cOIzNW1iFTN1c0ngyvhA2zjfJU X-Received: by 10.221.47.193 with SMTP id ut1mr752352vcb.8.1375868847736; Wed, 07 Aug 2013 02:47:27 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.11.8 with SMTP id pc8csp191799vcb; Wed, 7 Aug 2013 02:47:27 -0700 (PDT) X-Received: by 10.14.184.198 with SMTP id s46mr2202268eem.113.1375868845393; Wed, 07 Aug 2013 02:47:25 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id x7si5194211eeo.7.2013.08.07.02.47.24 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 07 Aug 2013 02:47:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1V70Ky-00073x-R2 for ; Wed, 07 Aug 2013 09:47:24 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id C0BEDE07E4 for ; Wed, 7 Aug 2013 09:47:24 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: lava-tool X-Launchpad-Branch: ~linaro-validation/lava-tool/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 192 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-tool/trunk] Rev 192: Fixed unit and integration tests. Message-Id: <20130807094724.16646.35110.launchpad@ackee.canonical.com> Date: Wed, 07 Aug 2013 09:47:24 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: list X-Generated-By: Launchpad (canonical.com); Revision="16721"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: e91426784c2c512e5f42daa5dba1e37e173ce40e X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: noreply@launchpad.net X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Merge authors: Milo Casagrande (milo) Related merge proposals: https://code.launchpad.net/~milo/lava-tool/unittest-fix/+merge/178913 proposed by: Milo Casagrande (milo) review: Approve - Antonio Terceiro (terceiro) ------------------------------------------------------------ revno: 192 [merge] committer: Milo Casagrande branch nick: trunk timestamp: Wed 2013-08-07 11:42:57 +0200 message: Fixed unit and integration tests. modified: ci-build lava/tests/test_config.py --- lp:lava-tool https://code.launchpad.net/~linaro-validation/lava-tool/trunk You are subscribed to branch lp:lava-tool. To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-tool/trunk/+edit-subscription === modified file 'ci-build' --- ci-build 2013-06-18 11:48:30 +0000 +++ ci-build 2013-08-07 08:54:55 +0000 @@ -33,8 +33,6 @@ pip install coverage fi -export LAVACONFIG=/dev/null - if test -z "$DISPLAY"; then # actual CI === modified file 'lava/tests/test_config.py' --- lava/tests/test_config.py 2013-07-31 12:35:26 +0000 +++ lava/tests/test_config.py 2013-08-07 08:38:50 +0000 @@ -23,6 +23,7 @@ import os import shutil import sys +import tempfile from StringIO import StringIO from mock import ( @@ -97,19 +98,22 @@ def setUp(self): super(ConfigTest, self).setUp() - self.patcher = patch("lava.config.DEFAULT_XDG_RESOURCE", "a_temp_dir") - self.patcher.start() - self.xdg_resource = os.path.join( - os.path.expanduser("~"), ".config/a_temp_dir") + + self.config_dir = os.path.join(tempfile.gettempdir(), "config") + self.xdg_resource = os.path.join(self.config_dir, "linaro") self.lavatool_resource = os.path.join(self.xdg_resource, "lava-tool") + + os.makedirs(self.lavatool_resource) + self.config = Config() + self.config._ensure_xdg_dirs = MagicMock( + return_value=self.lavatool_resource) self.config.save = MagicMock() def tearDown(self): super(ConfigTest, self).tearDown() - self.patcher.stop() - if os.path.isdir(self.xdg_resource): - shutil.rmtree(self.xdg_resource) + if os.path.isdir(self.config_dir): + shutil.rmtree(self.config_dir) def test_ensure_xdg_dirs(self): # Test that xdg can create the correct cache path, we remove it @@ -314,39 +318,3 @@ obtained = self.config.get(ListParameter("list")) self.assertIsInstance(obtained, list) self.assertEqual(expected, obtained) - - -class TestInteractiveCache(HelperTest): - - def setUp(self): - super(TestInteractiveCache, self).setUp() - self.patcher = patch("lava.config.DEFAULT_XDG_RESOURCE", "a_temp_dir") - self.patcher.start() - self.cache = InteractiveCache() - self.cache.save = MagicMock() - self.xdg_resource = os.path.join( - os.path.expanduser("~"), ".cache/a_temp_dir") - self.lavatool_resource = os.path.join(self.xdg_resource, "lava-tool") - - def tearDown(self): - super(TestInteractiveCache, self).tearDown() - self.patcher.stop() - if os.path.isdir(self.xdg_resource): - shutil.rmtree(self.xdg_resource) - - def test_default_xdg(self): - # Dummy test, only to make sure patching the module attribute works. - from lava.config import DEFAULT_XDG_RESOURCE - self.assertEquals(DEFAULT_XDG_RESOURCE, "a_temp_dir") - - def test_ensure_xdg_dirs(self): - # Test that xdg can create the correct cache path, we remove it - # at the end since we patch the default value. - obtained = self.cache._ensure_xdg_dirs() - self.assertEquals(self.lavatool_resource, obtained) - - def test_config_file(self): - expected = os.path.join(self.lavatool_resource, "parameters.ini") - obtained = self.cache.config_file - self.assertEquals(expected, obtained) -