summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Brattain <ross.b.brattain@intel.com>2018-01-11 22:23:18 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-01-11 22:23:18 +0000
commite11caa14f51beaa88c1cf6fda216a5f62cefb72d (patch)
treefc162894f28b35ab89af22dffddf42a9c831bc6f
parentc2c8b6b181026c5aaf9bcea655dcb2f4a2b1cad8 (diff)
parent4f5747c8bf3695694400a109e56a83469604a069 (diff)
Merge "Move tests: unit/apiserver/"
-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)