You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2015/04/02 23:47:11 UTC
svn commit: r1670984 - in /qpid/dispatch/branches/0.4/tests:
router_engine_test.py run_system_tests.py system_test.py
system_tests_qdmanage.py system_tests_qdstat.py system_tests_two_routers.py
Author: aconway
Date: Thu Apr 2 21:47:11 2015
New Revision: 1670984
URL: http://svn.apache.org/r1670984
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/branches/0.4/tests/router_engine_test.py
qpid/dispatch/branches/0.4/tests/run_system_tests.py
qpid/dispatch/branches/0.4/tests/system_test.py
qpid/dispatch/branches/0.4/tests/system_tests_qdmanage.py
qpid/dispatch/branches/0.4/tests/system_tests_qdstat.py
qpid/dispatch/branches/0.4/tests/system_tests_two_routers.py
Modified: qpid/dispatch/branches/0.4/tests/router_engine_test.py
URL: http://svn.apache.org/viewvc/qpid/dispatch/branches/0.4/tests/router_engine_test.py?rev=1670984&r1=1670983&r2=1670984&view=diff
==============================================================================
--- qpid/dispatch/branches/0.4/tests/router_engine_test.py (original)
+++ qpid/dispatch/branches/0.4/tests/router_engine_test.py Thu Apr 2 21:47:11 2015
@@ -20,9 +20,10 @@
import os
import sys
import unittest
+import system_test
sys.path.append(os.path.join(os.environ["SOURCE_DIR"], "python"))
-sys.path.append(os.path.join(os.path.dirname(__file__), "mock")) # Mock modules for tests
+sys.path.append(os.path.join(system_test.DIR, "mock")) # Mock modules for tests
from qpid_dispatch_internal.router.engine import HelloProtocol, PathEngine, NodeTracker
from qpid_dispatch_internal.router.data import LinkState, MessageHELLO
Modified: qpid/dispatch/branches/0.4/tests/run_system_tests.py
URL: http://svn.apache.org/viewvc/qpid/dispatch/branches/0.4/tests/run_system_tests.py?rev=1670984&r1=1670983&r2=1670984&view=diff
==============================================================================
--- qpid/dispatch/branches/0.4/tests/run_system_tests.py (original)
+++ qpid/dispatch/branches/0.4/tests/run_system_tests.py Thu Apr 2 21:47:11 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/branches/0.4/tests/system_test.py
URL: http://svn.apache.org/viewvc/qpid/dispatch/branches/0.4/tests/system_test.py?rev=1670984&r1=1670983&r2=1670984&view=diff
==============================================================================
--- qpid/dispatch/branches/0.4/tests/system_test.py (original)
+++ qpid/dispatch/branches/0.4/tests/system_test.py Thu Apr 2 21:47:11 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/branches/0.4/tests/system_tests_qdmanage.py
URL: http://svn.apache.org/viewvc/qpid/dispatch/branches/0.4/tests/system_tests_qdmanage.py?rev=1670984&r1=1670983&r2=1670984&view=diff
==============================================================================
--- qpid/dispatch/branches/0.4/tests/system_tests_qdmanage.py (original)
+++ qpid/dispatch/branches/0.4/tests/system_tests_qdmanage.py Thu Apr 2 21:47:11 2015
@@ -18,6 +18,7 @@
#
import re, json, unittest, os
+import system_test
from system_test import TestCase, Process, Qdrouterd, main_module
from subprocess import PIPE, STDOUT
from qpid_dispatch_internal.compat import OrderedDict, dictify
@@ -31,7 +32,7 @@ class QdmanageTest(TestCase):
@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/branches/0.4/tests/system_tests_qdstat.py
URL: http://svn.apache.org/viewvc/qpid/dispatch/branches/0.4/tests/system_tests_qdstat.py?rev=1670984&r1=1670983&r2=1670984&view=diff
==============================================================================
--- qpid/dispatch/branches/0.4/tests/system_tests_qdstat.py (original)
+++ qpid/dispatch/branches/0.4/tests/system_tests_qdstat.py Thu Apr 2 21:47:11 2015
@@ -76,7 +76,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/branches/0.4/tests/system_tests_two_routers.py
URL: http://svn.apache.org/viewvc/qpid/dispatch/branches/0.4/tests/system_tests_two_routers.py?rev=1670984&r1=1670983&r2=1670984&view=diff
==============================================================================
--- qpid/dispatch/branches/0.4/tests/system_tests_two_routers.py (original)
+++ qpid/dispatch/branches/0.4/tests/system_tests_two_routers.py Thu Apr 2 21:47:11 2015
@@ -743,7 +743,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