joey: thuban/Extensions/wms/test test_ogclib.py,1.3,1.4

cvs@intevation.de cvs at intevation.de
Thu Mar 18 18:13:30 CET 2004


Author: joey

Update of /thubanrepository/thuban/Extensions/wms/test
In directory doto:/tmp/cvs-serv30634

Modified Files:
	test_ogclib.py 
Log Message:
Added legacy code to add the main Thuban directory to the path in
order to be able to import random modules.  Adjusted the PyOGCLib
detection to reuse the information gathered.  Also added a note about
the PYTHONPATH environment variable.  This should ensure that the test
program can now be run from outside the test directory as well.

Index: test_ogclib.py
===================================================================
RCS file: /thubanrepository/thuban/Extensions/wms/test/test_ogclib.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- test_ogclib.py	18 Mar 2004 08:15:54 -0000	1.3
+++ test_ogclib.py	18 Mar 2004 17:13:28 -0000	1.4
@@ -10,8 +10,8 @@
 
 http://www.sourceforge.net/projects/pyogclib
 
-Requires the ogclib installed regularily on the system or checked out
-next to the Thuban checkout.
+Requires the ogclib installed regularily on the system, accessible via
+PYTHONPATH or checked out alongside the Thuban checkout.
 """
 
 __version__ = "$Revision$"
@@ -22,6 +22,16 @@
 import unittest
 
 from string import split
+from sys import path
+
+# Add the main Thuban directory so the path so that all modules are
+# accessible as expected
+#
+if os.path.dirname (__file__) == "" or os.path.dirname (__file__) == ".":
+    thubandir = os.path.abspath ("../../../")
+else:
+    thubandir = os.path.abspath (os.path.dirname(__file__) + "/../../..")
+path.insert (0, thubandir)
 
 # ----------------------------------------------------------------------
 # FIXME: Temporary code until PyOGCLib is a standard requirement
@@ -29,7 +39,9 @@
 from sys import path
 
 # Assume the PyOGCLib to be checked out next to the thuban main directory
-pyogclib = "../../../../PyOGCLib"
+# setting PYTHONPATH accordingly is fine as well
+#
+pyogclib = os.path.abspath (thubandir + "/../PyOGCLib")
 if os.path.isdir (pyogclib) and os.path.isdir (pyogclib + "/ogclib"):
     path.insert (0, pyogclib)
 # ----------------------------------------------------------------------





More information about the Thuban-devel mailing list

This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)