qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject svn commit: r1670985 - in /qpid/dispatch/trunk/tests: run_system_tests.py system_test.py system_tests_qdmanage.py system_tests_qdstat.py system_tests_two_routers.py
Date Thu, 02 Apr 2015 21:47:18 GMT
Author: aconway
Date: Thu Apr  2 21:47:17 2015
New Revision: 1670985

URL: http://svn.apache.org/r1670985
Log:
NO-JIRA: run_system_tests.py doesn't correctly locate config files.

run_system_tests.py was using the script location __file__ to find SSL certs and other config.
That works if the script is called with an absolute path (e.g. from ctest) but not if it
is called with a relative path (e.g. manually)

Changed the tests to use system_test.__file__ to find config. An imported module always has
an absolute path regardless of how the script is called.

Modified:
    qpid/dispatch/trunk/tests/run_system_tests.py
    qpid/dispatch/trunk/tests/system_test.py
    qpid/dispatch/trunk/tests/system_tests_qdmanage.py
    qpid/dispatch/trunk/tests/system_tests_qdstat.py
    qpid/dispatch/trunk/tests/system_tests_two_routers.py

Modified: qpid/dispatch/trunk/tests/run_system_tests.py
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/tests/run_system_tests.py?rev=1670985&r1=1670984&r2=1670985&view=diff
==============================================================================
--- qpid/dispatch/trunk/tests/run_system_tests.py (original)
+++ qpid/dispatch/trunk/tests/run_system_tests.py Thu Apr  2 21:47:17 2015
@@ -29,11 +29,12 @@ import os
 import sys
 from fnmatch import fnmatch
 import unittest
+import system_test
 
 # Collect all system_tests_*.py scripts in the same directory as this script.
-test_dir = os.path.normpath(os.path.dirname(__file__))
-test_modules = [os.path.splitext(f)[0] for f in os.listdir(test_dir) if fnmatch(f, "system_tests_*.py")]
-sys.path = [test_dir] + sys.path # Find test modules in sys.path
+test_modules = [os.path.splitext(f)[0] for f in os.listdir(system_test.DIR)
+                if fnmatch(f, "system_tests_*.py")]
+sys.path = [system_test.DIR] + sys.path # Find test modules in sys.path
 
 # python < 2.7 unittest main won't load tests from modules, so use the loader:
 all_tests = unittest.TestSuite()

Modified: qpid/dispatch/trunk/tests/system_test.py
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/tests/system_test.py?rev=1670985&r1=1670984&r2=1670985&view=diff
==============================================================================
--- qpid/dispatch/trunk/tests/system_test.py (original)
+++ qpid/dispatch/trunk/tests/system_test.py Thu Apr  2 21:47:17 2015
@@ -95,6 +95,8 @@ def find_exe(program):
                 return exe_file
     return None
 
+# The directory where this module lives. Used to locate static configuration files etc.
+DIR = os.path.dirname(__file__)
 
 def _check_requirements():
     """If requirements are missing, return a message, else return empty string."""

Modified: qpid/dispatch/trunk/tests/system_tests_qdmanage.py
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/tests/system_tests_qdmanage.py?rev=1670985&r1=1670984&r2=1670985&view=diff
==============================================================================
--- qpid/dispatch/trunk/tests/system_tests_qdmanage.py (original)
+++ qpid/dispatch/trunk/tests/system_tests_qdmanage.py Thu Apr  2 21:47:17 2015
@@ -18,7 +18,7 @@
 #
 
 import re, json, unittest, os
-from system_test import TestCase, Process, Qdrouterd, main_module, TIMEOUT
+from system_test import TestCase, Process, Qdrouterd, main_module, TIMEOUT, DIR
 from subprocess import PIPE, STDOUT
 from qpid_dispatch_internal.compat import OrderedDict, dictify
 from qpid_dispatch_internal.management.qdrouter import QdSchema
@@ -31,7 +31,7 @@ class QdmanageTest(TestCase):
 
     @staticmethod
     def ssl_file(name):
-        return os.path.join(os.path.dirname(__file__), 'ssl_certs', name)
+        return os.path.join(DIR, 'ssl_certs', name)
 
     @classmethod
     def setUpClass(cls):

Modified: qpid/dispatch/trunk/tests/system_tests_qdstat.py
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/tests/system_tests_qdstat.py?rev=1670985&r1=1670984&r2=1670985&view=diff
==============================================================================
--- qpid/dispatch/trunk/tests/system_tests_qdstat.py (original)
+++ qpid/dispatch/trunk/tests/system_tests_qdstat.py Thu Apr  2 21:47:17 2015
@@ -75,7 +75,7 @@ try:
 
         @staticmethod
         def ssl_file(name):
-            return os.path.join(os.path.dirname(__file__), 'ssl_certs', name)
+            return os.path.join(system_test.DIR, 'ssl_certs', name)
 
         @classmethod
         def setUpClass(cls):

Modified: qpid/dispatch/trunk/tests/system_tests_two_routers.py
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/tests/system_tests_two_routers.py?rev=1670985&r1=1670984&r2=1670985&view=diff
==============================================================================
--- qpid/dispatch/trunk/tests/system_tests_two_routers.py (original)
+++ qpid/dispatch/trunk/tests/system_tests_two_routers.py Thu Apr  2 21:47:17 2015
@@ -749,7 +749,7 @@ try:
         def ssl_config(self, client_server, connection):
             connection[1]['ssl-profile'] = 'ssl-profile-name'
             def ssl_file(name):
-                return os.path.join(os.path.dirname(__file__), 'config-2', name)
+                return os.path.join(system_test.DIR, 'config-2', name)
             return [
                 ('ssl-profile', {
                     'name': 'ssl-profile-name',



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message