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 2013/02/14 20:44:30 UTC

svn commit: r1446307 - in /qpid/proton/trunk/tests: pom.xml python/proton_tests/interop.py

Author: aconway
Date: Thu Feb 14 19:44:30 2013
New Revision: 1446307

URL: http://svn.apache.org/r1446307
Log:
PROTON-215: Interop test: make finding AMQP fragments more robust.

Python: find the interop fragments by walking up the directory tree from __file__.
Java: Copy AMQP fragments as resources.

Modified:
    qpid/proton/trunk/tests/pom.xml
    qpid/proton/trunk/tests/python/proton_tests/interop.py

Modified: qpid/proton/trunk/tests/pom.xml
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/tests/pom.xml?rev=1446307&r1=1446306&r2=1446307&view=diff
==============================================================================
--- qpid/proton/trunk/tests/pom.xml (original)
+++ qpid/proton/trunk/tests/pom.xml Thu Feb 14 19:44:30 2013
@@ -43,6 +43,7 @@ To override this, run Maven like so: &qu
     <testSourceDirectory>java</testSourceDirectory>
     <resources>
       <resource><directory>python</directory></resource>
+      <resource><directory>interop</directory></resource>
     </resources>
     <plugins>
       <plugin>

Modified: qpid/proton/trunk/tests/python/proton_tests/interop.py
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/tests/python/proton_tests/interop.py?rev=1446307&r1=1446306&r2=1446307&view=diff
==============================================================================
--- qpid/proton/trunk/tests/python/proton_tests/interop.py (original)
+++ qpid/proton/trunk/tests/python/proton_tests/interop.py Thu Feb 14 19:44:30 2013
@@ -20,6 +20,18 @@
 from proton import *
 import os, common
 
+
+def find_test_interop_dir():
+    """Walk up the directory tree to find the tests directory."""
+    f = os.path.dirname(__file__)
+    while f and os.path.basename(f) != "tests": f = os.path.dirname(f)
+    f = os.path.join(f, "interop")
+    if not os.path.isdir(f):
+        raise Exception("Cannot find test/interop directory from "+__file__)
+    return f
+
+test_interop_dir=find_test_interop_dir()
+
 class InteropTest(common.Test):
 
     def setup(self):
@@ -29,8 +41,7 @@ class InteropTest(common.Test):
         self.data = None
 
     def decode(self, name):
-        home = os.getenv("PROTON_HOME") or os.getcwd()
-        filename = os.path.join(home, "tests", "interop", name+".amqp")
+        filename = os.path.join(test_interop_dir, name+".amqp")
         f = open(filename)
         encoded = f.read()
         f.close()



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