You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by tr...@apache.org on 2013/10/31 21:22:11 UTC
svn commit: r1537621 - /qpid/dispatch/trunk/tests/system_tests_one_router.py
Author: tross
Date: Thu Oct 31 20:22:11 2013
New Revision: 1537621
URL: http://svn.apache.org/r1537621
Log:
NO-JIRA - Added fallback support for testing under Python libraries prior to 2.7
The tests will run considerably slower on pre-2.7 Python.
Modified:
qpid/dispatch/trunk/tests/system_tests_one_router.py
Modified: qpid/dispatch/trunk/tests/system_tests_one_router.py
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/tests/system_tests_one_router.py?rev=1537621&r1=1537620&r2=1537621&view=diff
==============================================================================
--- qpid/dispatch/trunk/tests/system_tests_one_router.py (original)
+++ qpid/dispatch/trunk/tests/system_tests_one_router.py Thu Oct 31 20:22:11 2013
@@ -17,27 +17,42 @@
# under the License.
#
+import sys
import os
import time
import unittest
import subprocess
from proton import Messenger, Message, PENDING, ACCEPTED, REJECTED
+def startRouter(obj):
+ if 'CTEST_SOURCE_DIR' not in os.environ:
+ raise Exception("Environment variable 'CTEST_SOURCE_DIR' not set")
+ srcdir = os.environ['CTEST_SOURCE_DIR']
+ obj.router = subprocess.Popen(['../router/qpid-dxrouterd', '-c', '%s/config-1/A.conf' % srcdir],
+ stderr=subprocess.PIPE, stdout=subprocess.PIPE)
+ time.sleep(1)
+
+def stopRouter(obj):
+ obj.router.terminate()
+ obj.router.wait()
+
+
class RouterTest(unittest.TestCase):
- @classmethod
- def setUpClass(cls):
- if 'CTEST_SOURCE_DIR' not in os.environ:
- raise Exception("Environment variable 'CTEST_SOURCE_DIR' not set")
- srcdir = os.environ['CTEST_SOURCE_DIR']
- cls.router = subprocess.Popen(['../router/qpid-dxrouterd', '-c', '%s/config-1/A.conf' % srcdir],
- stderr=subprocess.PIPE, stdout=subprocess.PIPE)
- time.sleep(1)
-
- @classmethod
- def tearDownClass(cls):
- cls.router.terminate()
- cls.router.wait()
+ if (sys.version_info.major == 2) and (sys.version_info.minor < 7):
+ def setUp(self):
+ startRouter(self)
+
+ def tearDown(self):
+ stopRouter(self)
+ else:
+ @classmethod
+ def setUpClass(cls):
+ startRouter(cls)
+
+ @classmethod
+ def tearDownClass(cls):
+ stopRouter(cls)
def flush(self, messenger):
while messenger.work(0.1):
@@ -193,11 +208,6 @@ class RouterTest(unittest.TestCase):
M4.settle(trk)
self.assertEqual(i, rm.body['number'])
- self.flush(M1)
- self.flush(M2)
- self.flush(M3)
- self.flush(M4)
-
M1.stop()
M2.stop()
M3.stop()
@@ -497,7 +507,7 @@ class RouterTest(unittest.TestCase):
M = Messenger()
M.start()
M.route("amqp:/*", "amqp://0.0.0.0:20000/$1")
- M.subscribe(reply)
+ self.subscribe(M, reply)
request = Message()
response = Message()
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org