summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmma Foley <emma.l.foley@intel.com>2017-11-29 23:01:33 +0000
committerRoss Brattain <ross.b.brattain@intel.com>2018-01-11 20:55:26 +0000
commit4f5747c8bf3695694400a109e56a83469604a069 (patch)
treec4c3fa5bb8bc1277bb3c88f74bda68e10f6999c6
parent5702f5b5e0721d9af61e494691376f32652e0048 (diff)
Move tests: unit/apiserver/
* Fix pylint errors * Add TODOs Some errors are ignored locally, as they were a symptom of other problems. These issues have been flagged with a TODO, and should be fixed later. JIRA: YARDSTICK-837 Signed-off-by: Emma Foley <emma.l.foley@intel.com> Change-Id: I30d3f61e5ea479758f9a2f39cf415da18e49b9d6
-rw-r--r--yardstick/tests/unit/apiserver/__init__.py (renamed from tests/unit/apiserver/__init__.py)17
-rw-r--r--yardstick/tests/unit/apiserver/resources/__init__.py (renamed from tests/unit/apiserver/resources/__init__.py)0
-rw-r--r--yardstick/tests/unit/apiserver/resources/test_env_action.py (renamed from tests/unit/apiserver/resources/test_env_action.py)3
-rw-r--r--yardstick/tests/unit/apiserver/utils/test_influx.py (renamed from tests/unit/apiserver/utils/test_influx.py)8
4 files changed, 18 insertions, 10 deletions
diff --git a/tests/unit/apiserver/__init__.py b/yardstick/tests/unit/apiserver/__init__.py
index 5e1ed2ea1..44d163429 100644
--- a/tests/unit/apiserver/__init__.py
+++ b/yardstick/tests/unit/apiserver/__init__.py
@@ -1,3 +1,12 @@
+##############################################################################
+# Copyright (c) 2017
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+"""Tests for yardstick/api/server.py"""
from __future__ import absolute_import
import mock
@@ -12,14 +21,16 @@ from yardstick.common import constants as consts
class APITestCase(unittest.TestCase):
-
+ """Tests for the YardStick API server"""
def setUp(self):
self.db_fd, self.db_path = tempfile.mkstemp()
consts.SQLITE = 'sqlite:///{}'.format(self.db_path)
- # server calls gethostbyname which takes 4 seconds, and we should mock it anyway
+ # server calls gethostbyname which takes 4 seconds, and we should mock
+ # it anyway
self.socket_mock = mock.patch.dict("sys.modules", {"socket": mock.MagicMock(
- **{"gethostbyname.return_value": "127.0.0.1", "gethostname.return_value": "localhost"})})
+ **{"gethostbyname.return_value": "127.0.0.1",
+ "gethostname.return_value": "localhost"})})
self.socket_mock.start()
try:
from api import server
diff --git a/tests/unit/apiserver/resources/__init__.py b/yardstick/tests/unit/apiserver/resources/__init__.py
index e69de29bb..e69de29bb 100644
--- a/tests/unit/apiserver/resources/__init__.py
+++ b/yardstick/tests/unit/apiserver/resources/__init__.py
diff --git a/tests/unit/apiserver/resources/test_env_action.py b/yardstick/tests/unit/apiserver/resources/test_env_action.py
index 5417ad953..b7bfe294d 100644
--- a/tests/unit/apiserver/resources/test_env_action.py
+++ b/yardstick/tests/unit/apiserver/resources/test_env_action.py
@@ -6,12 +6,11 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-from __future__ import absolute_import
import time
import unittest
-from tests.unit.apiserver import APITestCase
+from yardstick.tests.unit.apiserver import APITestCase
class EnvTestCase(APITestCase):
diff --git a/tests/unit/apiserver/utils/test_influx.py b/yardstick/tests/unit/apiserver/utils/test_influx.py
index aff0cab5c..883608bb2 100644
--- a/tests/unit/apiserver/utils/test_influx.py
+++ b/yardstick/tests/unit/apiserver/utils/test_influx.py
@@ -6,13 +6,11 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-from __future__ import absolute_import
import unittest
import mock
from api.utils import influx
-
-import six.moves.configparser as ConfigParser
+from six.moves import configparser as ConfigParser
class GetDataDbClientTestCase(unittest.TestCase):
@@ -25,7 +23,7 @@ class GetDataDbClientTestCase(unittest.TestCase):
mock_parser.NoOptionError = ConfigParser.NoOptionError
try:
influx.get_data_db_client()
- except Exception as e:
+ except Exception as e: # pylint: disable=broad-except
self.assertIsInstance(e, RuntimeError)
@@ -50,7 +48,7 @@ class QueryTestCase(unittest.TestCase):
try:
sql = 'select * form tasklist'
influx.query(sql)
- except Exception as e:
+ except Exception as e: # pylint: disable=broad-except
self.assertIsInstance(e, RuntimeError)