diff options
author | 2016-04-22 09:44:01 +0200 | |
---|---|---|
committer | 2016-04-22 10:07:01 +0200 | |
commit | e452376fbc44df9cf0688571e1882498f456f3a4 (patch) | |
tree | 306e1a34a898368ca412b5d081b72beccbd2454f | |
parent | 430753939dd6788b8c3567eb149daef0aeb61b2e (diff) |
Enable PYTHONPATH env variable inside the container
JIRA: FUNCTEST-224
Change-Id: Ib10dc312a761b06fe36174c5c19a0165f746593e
Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
-rw-r--r-- | docker/Dockerfile | 1 | ||||
-rw-r--r-- | testcases/Controllers/ODL/CI/odlreport2db.py | 7 | ||||
-rw-r--r-- | testcases/Controllers/ONOS/Teston/CI/onosfunctest.py | 13 | ||||
-rw-r--r-- | testcases/VIM/OpenStack/CI/libraries/clean_openstack.py | 5 | ||||
-rw-r--r-- | testcases/VIM/OpenStack/CI/libraries/generate_defaults.py | 6 | ||||
-rwxr-xr-x | testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py | 8 | ||||
-rw-r--r-- | testcases/VIM/OpenStack/CI/libraries/run_tempest.py | 9 | ||||
-rw-r--r-- | testcases/features/doctor.py | 5 | ||||
-rw-r--r-- | testcases/features/promise.py | 8 | ||||
-rw-r--r-- | testcases/tests/TestFunctestUtils.py | 7 | ||||
-rw-r--r-- | testcases/vIMS/CI/vIMS.py | 23 | ||||
-rw-r--r-- | testcases/vPing/CI/libraries/vPing_ssh.py | 8 | ||||
-rw-r--r-- | testcases/vPing/CI/libraries/vPing_userdata.py | 16 |
13 files changed, 54 insertions, 62 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile index 9aefc018..b1e41247 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -33,6 +33,7 @@ ENV repos_dir /home/opnfv/repos ENV creds /home/opnfv/functest/conf/openstack.creds ENV TERM xterm ENV COLORTERM gnome-terminal +ENV PYTHONPATH $PYTHONPATH:/home/opnfv/repos/functest/testcases/ WORKDIR /home/opnfv # Packaged dependencies 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) |