Enable PYTHONPATH env variable inside the container
authorjose.lausuch <jose.lausuch@ericsson.com>
Fri, 22 Apr 2016 07:44:01 +0000 (09:44 +0200)
committerjose.lausuch <jose.lausuch@ericsson.com>
Fri, 22 Apr 2016 08:07:01 +0000 (10:07 +0200)
JIRA: FUNCTEST-224

Change-Id: Ib10dc312a761b06fe36174c5c19a0165f746593e
Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
13 files changed:
docker/Dockerfile
testcases/Controllers/ODL/CI/odlreport2db.py
testcases/Controllers/ONOS/Teston/CI/onosfunctest.py
testcases/VIM/OpenStack/CI/libraries/clean_openstack.py
testcases/VIM/OpenStack/CI/libraries/generate_defaults.py
testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py
testcases/VIM/OpenStack/CI/libraries/run_tempest.py
testcases/features/doctor.py
testcases/features/promise.py
testcases/tests/TestFunctestUtils.py
testcases/vIMS/CI/vIMS.py
testcases/vPing/CI/libraries/vPing_ssh.py
testcases/vPing/CI/libraries/vPing_userdata.py

index 9aefc01..b1e4124 100644 (file)
@@ -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
index 3a696eb..f236ddc 100644 (file)
 # 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
 
 
index 73b4b63..d36cf5e 100644 (file)
@@ -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()
index bff71f4..c5cfb07 100644 (file)
@@ -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'
 
index e67e4de..5e799e4 100644 (file)
@@ -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'
 
index 3ac3d44..6e625ce 100755 (executable)
@@ -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)
index 951210c..9d8b7be 100644 (file)
@@ -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)
index 0c1f713..9ca6bf6 100644 (file)
 #
 
 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()
index d501d67..04ca87a 100644 (file)
@@ -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)
index 024088b..e1f81ec 100644 (file)
@@ -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
 
 
index 2518855..fcc0563 100644 (file)
 # 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)
index dc46c89..3d2ff70 100644 (file)
@@ -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)
index 20a47ae..0adfc6d 100644 (file)
 #
 #
 
-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)