summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2018-06-14 21:20:59 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2018-07-27 14:33:52 +0200
commit09052b87b7f8c7e278d64e90948e2f2826aac9cd (patch)
treebe02a2e9b2f26d381f8c015e37b813404f6ac34c
parenta321d59c36f368a3a1aeefaa09c9e66b1e8c13c0 (diff)
Support py3 in uncovered packages
It has to be noted that cloudify_rest_client doesn't support py3 then next unit tests vs cloudify-based testcases would be excluded. Change-Id: I0b0e64929d1238665c778ce51fd6abd5ccf06b6c Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com> (cherry picked from commit 7f2d7515e068c2ba072d4f3b4cf0997e06ae8460)
-rw-r--r--functest/api/resources/v1/testcases.py4
-rw-r--r--functest/api/server.py5
-rw-r--r--functest/opnfv_tests/vnf/epc/juju_epc.py17
-rw-r--r--functest/opnfv_tests/vnf/ims/cloudify_ims.py10
-rw-r--r--functest/opnfv_tests/vnf/router/cloudify_vrouter.py5
-rw-r--r--tox.ini4
6 files changed, 25 insertions, 20 deletions
diff --git a/functest/api/resources/v1/testcases.py b/functest/api/resources/v1/testcases.py
index 2dbf97e4d..39e0afb6b 100644
--- a/functest/api/resources/v1/testcases.py
+++ b/functest/api/resources/v1/testcases.py
@@ -11,7 +11,6 @@
Resources to handle testcase related requests
"""
-import ConfigParser
import logging
import os
import re
@@ -21,6 +20,7 @@ import uuid
from flask import jsonify
from flasgger.utils import swag_from
import pkg_resources
+from six.moves import configparser
from functest.api.base import ApiResource
from functest.api.common import api_utils, thread
@@ -144,7 +144,7 @@ class V1Testcase(ApiResource):
def _update_logging_ini(self, task_id): # pylint: disable=no-self-use
""" Update the log file for each task"""
- rconfig = ConfigParser.RawConfigParser()
+ rconfig = configparser.RawConfigParser()
rconfig.read(
pkg_resources.resource_filename('functest', 'ci/logging.ini'))
log_path = os.path.join(getattr(config.CONF, 'dir_results'),
diff --git a/functest/api/server.py b/functest/api/server.py
index 2a6b228ff..b27929a3e 100644
--- a/functest/api/server.py
+++ b/functest/api/server.py
@@ -15,12 +15,12 @@ Used to launch Functest RestApi
import inspect
import logging
import socket
-from urlparse import urljoin
import pkg_resources
from flask import Flask
from flask_restful import Api
from flasgger import Swagger
+import six
from functest.api.base import ApiResource
from functest.api.common import api_utils
@@ -57,7 +57,8 @@ def get_resource(resource_name):
def get_endpoint(url):
""" Obtain the endpoint of url """
address = socket.gethostbyname(socket.gethostname())
- return urljoin('http://{}:5000'.format(address), url)
+ return six.moves.urllib.parse.urljoin(
+ 'http://{}:5000'.format(address), url)
def api_add_resource():
diff --git a/functest/opnfv_tests/vnf/epc/juju_epc.py b/functest/opnfv_tests/vnf/epc/juju_epc.py
index cabaf6db1..f3295d989 100644
--- a/functest/opnfv_tests/vnf/epc/juju_epc.py
+++ b/functest/opnfv_tests/vnf/epc/juju_epc.py
@@ -18,15 +18,10 @@ import subprocess
import sys
import uuid
from copy import deepcopy
-from urlparse import urljoin
import pkg_resources
import yaml
-from functest.core import vnf
-from functest.opnfv_tests.openstack.snaps import snaps_utils
-from functest.utils import config
-from functest.utils import env
-
+import six
from snaps.config.flavor import FlavorConfig
from snaps.config.image import ImageConfig
from snaps.config.network import NetworkConfig, SubnetConfig
@@ -43,6 +38,11 @@ from snaps.openstack.create_user import OpenStackUser
from snaps.openstack.utils import keystone_utils
from snaps.openstack.utils import nova_utils
+from functest.core import vnf
+from functest.opnfv_tests.openstack.snaps import snaps_utils
+from functest.utils import config
+from functest.utils import env
+
__author__ = "Amarendra Meher <amarendra@rebaca.com>"
__author__ = "Soumaya K Nayek <soumaya.nayek@rebaca.com>"
@@ -228,7 +228,8 @@ class JujuEpc(vnf.VnfOnBoarding):
# it enforces a versioned public identity endpoint as juju simply
# adds /auth/tokens wich fails vs an unversioned endpoint.
if not self.public_auth_url.endswith(('v3', 'v3/', 'v2.0', 'v2.0/')):
- self.public_auth_url = urljoin(self.public_auth_url, 'v3')
+ self.public_auth_url = six.moves.urllib.parse.urljoin(
+ self.public_auth_url, 'v3')
self._register_cloud()
if self.snaps_creds.identity_api_version == 3:
self._register_credentials_v3()
@@ -287,7 +288,7 @@ class JujuEpc(vnf.VnfOnBoarding):
self.__logger.info("Upload some OS images if it doesn't exist")
images = get_config("tenant_images", self.config_file)
self.__logger.info("Images needed for vEPC: %s", images)
- for image_name, image_file in images.iteritems():
+ for image_name, image_file in six.iteritems(images):
self.__logger.info("image: %s, file: %s", image_name, image_file)
if image_file and image_name:
image_creator = OpenStackImage(self.snaps_creds, ImageConfig(
diff --git a/functest/opnfv_tests/vnf/ims/cloudify_ims.py b/functest/opnfv_tests/vnf/ims/cloudify_ims.py
index 7c7063244..786c535ed 100644
--- a/functest/opnfv_tests/vnf/ims/cloudify_ims.py
+++ b/functest/opnfv_tests/vnf/ims/cloudify_ims.py
@@ -19,8 +19,7 @@ import uuid
from cloudify_rest_client import CloudifyClient
from cloudify_rest_client.executions import Execution
from scp import SCPClient
-import yaml
-
+import six
from snaps.config.flavor import FlavorConfig
from snaps.config.image import ImageConfig
from snaps.config.keypair import KeypairConfig
@@ -40,9 +39,10 @@ from snaps.openstack.create_security_group import OpenStackSecurityGroup
from snaps.openstack.create_user import OpenStackUser
from snaps.openstack.utils import keystone_utils
from xtesting.energy import energy
+import yaml
from functest.opnfv_tests.openstack.snaps import snaps_utils
-import functest.opnfv_tests.vnf.ims.clearwater_ims_base as clearwater_ims_base
+from functest.opnfv_tests.vnf.ims import clearwater_ims_base
from functest.utils import config
from functest.utils import env
@@ -165,7 +165,7 @@ class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase):
# needs some images
self.__logger.info("Upload some OS images if it doesn't exist")
- for image_name, image_file in self.images.iteritems():
+ for image_name, image_file in six.iteritems(self.images):
self.__logger.info("image: %s, file: %s", image_name, image_file)
if image_file and image_name:
image_creator = OpenStackImage(
@@ -275,7 +275,7 @@ class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase):
raise Exception("Cloudify Manager isn't up and running")
self.__logger.info("Put OpenStack creds in manager")
secrets_list = cfy_client.secrets.list()
- for k, val in cfy_creds.iteritems():
+ for k, val in six.iteritems(cfy_creds):
if not any(d.get('key', None) == k for d in secrets_list):
cfy_client.secrets.create(k, val)
else:
diff --git a/functest/opnfv_tests/vnf/router/cloudify_vrouter.py b/functest/opnfv_tests/vnf/router/cloudify_vrouter.py
index 653b1ff12..b2982e811 100644
--- a/functest/opnfv_tests/vnf/router/cloudify_vrouter.py
+++ b/functest/opnfv_tests/vnf/router/cloudify_vrouter.py
@@ -50,6 +50,9 @@ import snaps.openstack.utils.glance_utils as glance_utils
from snaps.openstack.utils import keystone_utils
+import six
+
+
__author__ = "Shuya Nakama <shuya.nakama@okinawaopenlabs.org>"
@@ -180,7 +183,7 @@ class CloudifyVrouter(vrouter_base.VrouterOnBoardingBase):
self.created_object.append(keypair_creator)
self.__logger.info("Upload some OS images if it doesn't exist")
- for image_name, image_file in self.images.iteritems():
+ for image_name, image_file in six.iteritems(self.images):
self.__logger.info("image: %s, file: %s", image_name, image_file)
if image_file and image_name:
image_creator = OpenStackImage(
diff --git a/tox.ini b/tox.ini
index dc1c180ea..e196d4221 100644
--- a/tox.ini
+++ b/tox.ini
@@ -99,9 +99,9 @@ commands =
dirs =
functest/tests/unit/ci
functest/tests/unit/cli
+ functest/tests/unit/core
functest/tests/unit/odl
- functest/tests/unit/openstack/rally
- functest/tests/unit/openstack/tempest
+ functest/tests/unit/openstack
functest/tests/unit/utils
commands = nosetests {[testenv:py35]dirs}