From e452376fbc44df9cf0688571e1882498f456f3a4 Mon Sep 17 00:00:00 2001 From: "jose.lausuch" Date: Fri, 22 Apr 2016 09:44:01 +0200 Subject: Enable PYTHONPATH env variable inside the container JIRA: FUNCTEST-224 Change-Id: Ib10dc312a761b06fe36174c5c19a0165f746593e Signed-off-by: jose.lausuch --- testcases/Controllers/ODL/CI/odlreport2db.py | 7 +++---- .../Controllers/ONOS/Teston/CI/onosfunctest.py | 13 ++++++------ .../VIM/OpenStack/CI/libraries/clean_openstack.py | 5 ++--- .../OpenStack/CI/libraries/generate_defaults.py | 6 +++--- .../VIM/OpenStack/CI/libraries/run_rally-cert.py | 8 ++++---- .../VIM/OpenStack/CI/libraries/run_tempest.py | 9 +++++---- testcases/features/doctor.py | 5 +---- testcases/features/promise.py | 8 +++----- testcases/tests/TestFunctestUtils.py | 7 +++---- testcases/vIMS/CI/vIMS.py | 23 +++++++++++----------- testcases/vPing/CI/libraries/vPing_ssh.py | 8 ++++---- testcases/vPing/CI/libraries/vPing_userdata.py | 16 +++++++-------- 12 files changed, 53 insertions(+), 62 deletions(-) (limited to 'testcases') diff --git a/testcases/Controllers/ODL/CI/odlreport2db.py b/testcases/Controllers/ODL/CI/odlreport2db.py index 3a696eb2..f236ddcb 100644 --- a/testcases/Controllers/ODL/CI/odlreport2db.py +++ b/testcases/Controllers/ODL/CI/odlreport2db.py @@ -20,14 +20,13 @@ # 0.2: measure test duration and publish results under json format # # -import xmltodict + +import getopt import json import sys -import getopt +import xmltodict import yaml - -sys.path.append("/home/opnfv/repos/functest/testcases") import functest_utils diff --git a/testcases/Controllers/ONOS/Teston/CI/onosfunctest.py b/testcases/Controllers/ONOS/Teston/CI/onosfunctest.py index 73b4b63b..d36cf5ed 100644 --- a/testcases/Controllers/ONOS/Teston/CI/onosfunctest.py +++ b/testcases/Controllers/ONOS/Teston/CI/onosfunctest.py @@ -14,14 +14,15 @@ lanqinglong@huawei.com # """ +import argparse +import datetime +import logging import os +import re import time -import sys -import logging import yaml -import datetime -import re -import argparse + +import functest_utils parser = argparse.ArgumentParser() parser.add_argument("-i", "--installer", help="Installer type") @@ -54,8 +55,6 @@ REPO_PATH = ONOS_REPO_PATH + '/functest/' if not os.path.exists(REPO_PATH): logger.error("Functest repository directory not found '%s'" % REPO_PATH) exit(-1) -sys.path.append(REPO_PATH + "testcases/") -import functest_utils ONOSCI_PATH = REPO_PATH + 'testcases/Controllers/ONOS/Teston/CI/' starttime = datetime.datetime.now() diff --git a/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py b/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py index bff71f4e..c5cfb07a 100644 --- a/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py +++ b/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py @@ -23,7 +23,6 @@ import argparse import logging import os -import sys import time import yaml @@ -32,6 +31,8 @@ from neutronclient.v2_0 import client as neutronclient from keystoneclient.v2_0 import client as keystoneclient from cinderclient import client as cinderclient +import openstack_utils + parser = argparse.ArgumentParser() parser.add_argument("-d", "--debug", help="Debug mode", action="store_true") args = parser.parse_args() @@ -53,8 +54,6 @@ ch.setFormatter(formatter) logger.addHandler(ch) REPO_PATH = os.environ['repos_dir'] + '/functest/' -sys.path.append(REPO_PATH + "testcases/") -import openstack_utils DEFAULTS_FILE = '/home/opnfv/functest/conf/os_defaults.yaml' diff --git a/testcases/VIM/OpenStack/CI/libraries/generate_defaults.py b/testcases/VIM/OpenStack/CI/libraries/generate_defaults.py index e67e4dee..5e799e4c 100644 --- a/testcases/VIM/OpenStack/CI/libraries/generate_defaults.py +++ b/testcases/VIM/OpenStack/CI/libraries/generate_defaults.py @@ -23,7 +23,6 @@ import argparse import logging import os -import sys import yaml from novaclient import client as novaclient @@ -31,6 +30,8 @@ from neutronclient.v2_0 import client as neutronclient from keystoneclient.v2_0 import client as keystoneclient from cinderclient import client as cinderclient +import openstack_utils + parser = argparse.ArgumentParser() parser.add_argument("-d", "--debug", help="Debug mode", action="store_true") args = parser.parse_args() @@ -55,8 +56,7 @@ REPO_PATH = os.environ['repos_dir'] + '/functest/' if not os.path.exists(REPO_PATH): logger.error("Functest repository directory not found '%s'" % REPO_PATH) exit(-1) -sys.path.append(REPO_PATH + "testcases/") -import openstack_utils + DEFAULTS_FILE = '/home/opnfv/functest/conf/os_defaults.yaml' diff --git a/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py b/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py index 3ac3d449..6e625ce5 100755 --- a/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py +++ b/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py @@ -21,7 +21,6 @@ import os import re import requests import subprocess -import sys import time import yaml @@ -31,6 +30,9 @@ from keystoneclient.v2_0 import client as keystoneclient from neutronclient.v2_0 import client as neutronclient from cinderclient import client as cinderclient +import functest_utils +import openstack_utils + """ tests configuration """ tests = ['authenticate', 'glance', 'cinder', 'heat', 'keystone', 'neutron', 'nova', 'quotas', 'requests', 'vm', 'all'] @@ -87,9 +89,7 @@ REPO_PATH = os.environ['repos_dir'] + '/functest/' if not os.path.exists(REPO_PATH): logger.error("Functest repository directory not found '%s'" % REPO_PATH) exit(-1) -sys.path.append(REPO_PATH + "testcases/") -import functest_utils -import openstack_utils + with open("/home/opnfv/functest/conf/config_functest.yaml") as f: functest_yaml = yaml.safe_load(f) diff --git a/testcases/VIM/OpenStack/CI/libraries/run_tempest.py b/testcases/VIM/OpenStack/CI/libraries/run_tempest.py index 951210ce..9d8b7be8 100644 --- a/testcases/VIM/OpenStack/CI/libraries/run_tempest.py +++ b/testcases/VIM/OpenStack/CI/libraries/run_tempest.py @@ -21,12 +21,15 @@ import re import requests import shutil import subprocess -import sys import time import yaml + import keystoneclient.v2_0.client as ksclient from neutronclient.v2_0 import client as neutronclient +import functest_utils +import openstack_utils + modes = ['full', 'smoke', 'baremetal', 'compute', 'data_processing', 'identity', 'image', 'network', 'object_storage', 'orchestration', 'telemetry', 'volume', 'custom', 'defcore'] @@ -67,9 +70,7 @@ ch.setFormatter(formatter) logger.addHandler(ch) REPO_PATH = os.environ['repos_dir'] + '/functest/' -sys.path.append(REPO_PATH + "testcases/") -import functest_utils -import openstack_utils + with open("/home/opnfv/functest/conf/config_functest.yaml") as f: functest_yaml = yaml.safe_load(f) diff --git a/testcases/features/doctor.py b/testcases/features/doctor.py index 0c1f713e..9ca6bf61 100644 --- a/testcases/features/doctor.py +++ b/testcases/features/doctor.py @@ -15,10 +15,10 @@ # import logging -import sys import time import yaml +import functest_utils with open('/home/opnfv/functest/conf/config_functest.yaml') as f: functest_yaml = yaml.safe_load(f) @@ -28,9 +28,6 @@ FUNCTEST_REPO = dirs.get('dir_repo_functest') DOCTOR_REPO = dirs.get('dir_repo_doctor') TEST_DB_URL = functest_yaml.get('results').get('test_db_url') -sys.path.append('%s/testcases' % FUNCTEST_REPO) -import functest_utils - logger = logging.getLogger('doctor') logger.setLevel(logging.DEBUG) ch = logging.StreamHandler() diff --git a/testcases/features/promise.py b/testcases/features/promise.py index d501d676..04ca87a7 100644 --- a/testcases/features/promise.py +++ b/testcases/features/promise.py @@ -15,7 +15,6 @@ import logging import os import requests import subprocess -import sys import yaml import keystoneclient.v2_0.client as ksclient @@ -23,6 +22,9 @@ import glanceclient.client as glclient import novaclient.client as nvclient from neutronclient.v2_0 import client as ntclient +import functest_utils +import openstack_utils + parser = argparse.ArgumentParser() parser.add_argument("-d", "--debug", help="Debug mode", action="store_true") @@ -58,10 +60,6 @@ GLANCE_IMAGE_FORMAT = functest_yaml.get('general'). \ GLANCE_IMAGE_PATH = functest_yaml.get('general'). \ get('directories').get('dir_functest_data') + "/" + GLANCE_IMAGE_FILENAME -sys.path.append('%s/testcases' % FUNCTEST_REPO) -import functest_utils -import openstack_utils - """ logging configuration """ logger = logging.getLogger('Promise') logger.setLevel(logging.DEBUG) diff --git a/testcases/tests/TestFunctestUtils.py b/testcases/tests/TestFunctestUtils.py index 024088b1..e1f81ecd 100644 --- a/testcases/tests/TestFunctestUtils.py +++ b/testcases/tests/TestFunctestUtils.py @@ -1,9 +1,8 @@ -import unittest +#!/usr/bin/python + import os -import sys +import unittest import yaml - -sys.path.append("../") from functest_utils import getTestEnv, isTestRunnable, generateTestcaseList diff --git a/testcases/vIMS/CI/vIMS.py b/testcases/vIMS/CI/vIMS.py index 2518855c..fcc05635 100644 --- a/testcases/vIMS/CI/vIMS.py +++ b/testcases/vIMS/CI/vIMS.py @@ -11,24 +11,26 @@ # http://www.apache.org/licenses/LICENSE-2.0 ######################################################################## -import os -import time -import subprocess -import logging import argparse -import yaml -import pprint -import sys -import json import datetime +import json +import logging +import os +import pprint import requests +import subprocess +import time +import yaml + import keystoneclient.v2_0.client as ksclient import glanceclient.client as glclient import novaclient.client as nvclient from neutronclient.v2_0 import client as ntclient -import orchestrator import clearwater +import functest_utils +import openstack_utils +import orchestrator pp = pprint.PrettyPrinter(indent=4) @@ -61,9 +63,6 @@ REPO_PATH = os.environ['repos_dir'] + '/functest/' if not os.path.exists(REPO_PATH): logger.error("Functest repository directory not found '%s'" % REPO_PATH) exit(-1) -sys.path.append(REPO_PATH + "testcases/") -import functest_utils -import openstack_utils with open("/home/opnfv/functest/conf/config_functest.yaml") as f: functest_yaml = yaml.safe_load(f) diff --git a/testcases/vPing/CI/libraries/vPing_ssh.py b/testcases/vPing/CI/libraries/vPing_ssh.py index dc46c89d..3d2ff708 100644 --- a/testcases/vPing/CI/libraries/vPing_ssh.py +++ b/testcases/vPing/CI/libraries/vPing_ssh.py @@ -20,15 +20,18 @@ import os import paramiko import pprint import re -import sys import time import yaml from scp import SCPClient + from novaclient import client as novaclient from neutronclient.v2_0 import client as neutronclient from keystoneclient.v2_0 import client as keystoneclient from glanceclient import client as glanceclient +import functest_utils +import openstack_utils + pp = pprint.PrettyPrinter(indent=4) parser = argparse.ArgumentParser() @@ -64,9 +67,6 @@ REPO_PATH = os.environ['repos_dir'] + '/functest/' if not os.path.exists(REPO_PATH): logger.error("Functest repository directory not found '%s'" % REPO_PATH) exit(-1) -sys.path.append(REPO_PATH + "testcases/") -import functest_utils -import openstack_utils with open("/home/opnfv/functest/conf/config_functest.yaml") as f: functest_yaml = yaml.safe_load(f) diff --git a/testcases/vPing/CI/libraries/vPing_userdata.py b/testcases/vPing/CI/libraries/vPing_userdata.py index 20a47aea..0adfc6db 100644 --- a/testcases/vPing/CI/libraries/vPing_userdata.py +++ b/testcases/vPing/CI/libraries/vPing_userdata.py @@ -14,19 +14,22 @@ # # -import os -import time import argparse -import pprint -import sys +import datetime import logging +import os +import pprint +import time import yaml -import datetime + from novaclient import client as novaclient from neutronclient.v2_0 import client as neutronclient from keystoneclient.v2_0 import client as keystoneclient from glanceclient import client as glanceclient +import functest_utils +import openstack_utils + pp = pprint.PrettyPrinter(indent=4) parser = argparse.ArgumentParser() @@ -61,9 +64,6 @@ REPO_PATH = os.environ['repos_dir'] + '/functest/' if not os.path.exists(REPO_PATH): logger.error("Functest repository directory not found '%s'" % REPO_PATH) exit(-1) -sys.path.append(REPO_PATH + "testcases/") -import functest_utils -import openstack_utils with open("/home/opnfv/functest/conf/config_functest.yaml") as f: functest_yaml = yaml.safe_load(f) -- cgit 1.2.3-korg