Return-Path: X-Original-To: apmail-qpid-commits-archive@www.apache.org Delivered-To: apmail-qpid-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6485D17493 for ; Thu, 2 Apr 2015 21:47:18 +0000 (UTC) Received: (qmail 48943 invoked by uid 500); 2 Apr 2015 21:47:18 -0000 Delivered-To: apmail-qpid-commits-archive@qpid.apache.org Received: (qmail 48918 invoked by uid 500); 2 Apr 2015 21:47:18 -0000 Mailing-List: contact commits-help@qpid.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@qpid.apache.org Delivered-To: mailing list commits@qpid.apache.org Received: (qmail 48909 invoked by uid 99); 2 Apr 2015 21:47:18 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Apr 2015 21:47:18 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id 33102AC012B for ; Thu, 2 Apr 2015 21:47:18 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@qpid.apache.org From: aconway@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150402214718.33102AC012B@hades.apache.org> 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