[Thuban-commits] r2702 - in trunk/thuban: . Extensions/ogr/test

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Sun Sep 24 11:26:22 CEST 2006


Author: bernhard
Date: 2006-09-24 11:26:21 +0200 (Sun, 24 Sep 2006)
New Revision: 2702

Modified:
   trunk/thuban/ChangeLog
   trunk/thuban/Extensions/ogr/test/test_OGRShapestore.py
Log:
* Extensions/ogr/test/test_OGRShapestore.py: fixed skip_if_no_ogr()
and added it to TestOGRTable.setUp() so that all tests get skipped
if ogr cannot be imported. Added (c) year 2006.


Modified: trunk/thuban/ChangeLog
===================================================================
--- trunk/thuban/ChangeLog	2006-09-18 14:29:57 UTC (rev 2701)
+++ trunk/thuban/ChangeLog	2006-09-24 09:26:21 UTC (rev 2702)
@@ -1,3 +1,9 @@
+2006-09-23 Bernhard Reiter <bernhard at intevation.de>
+
+	* Extensions/ogr/test/test_OGRShapestore.py: fixed skip_if_no_ogr()
+	and added it to TestOGRTable.setUp() so that all tests get skipped
+	if ogr cannot be imported. Added (c) year 2006.
+
 2006-09-18 Didrik Pinte <dpinte at itae.be>
 	
 	* wxPython 2.6 update : wx 2.4 syntax has been updated to 2.6

Modified: trunk/thuban/Extensions/ogr/test/test_OGRShapestore.py
===================================================================
--- trunk/thuban/Extensions/ogr/test/test_OGRShapestore.py	2006-09-18 14:29:57 UTC (rev 2701)
+++ trunk/thuban/Extensions/ogr/test/test_OGRShapestore.py	2006-09-24 09:26:21 UTC (rev 2702)
@@ -1,4 +1,4 @@
-# Copyright (C) 2004 by Intevation GmbH
+# Copyright (C) 2004,2006 by Intevation GmbH
 # Authors:
 # Nina Hueffmeyer <nhueffme at intevation.de>
 #
@@ -17,10 +17,11 @@
 
 try:
     import ogr
+    ogr_imported = True
 except ImportError:
     # No ogr available. The tests will
     # be skipped completely.
-    pass
+    ogr_imported = False
 
 # If run directly as a script, add Thuban's test directory to the path
 # as well as the extensions own directory (i.e. parent).
@@ -42,8 +43,9 @@
 
 
 def skip_if_no_ogr():
-    if ogr is None:
-        raise support.SkipTest("Can't run ogr tests because ogr couldn't be                                    imported.")
+    if not ogr_imported:
+        raise support.SkipTest( \
+            "Can't run ogr tests because ogr couldn't be imported.")
 
 class TestOGRShapeStore_shp(unittest.TestCase, support.FloatComparisonMixin):
 
@@ -164,6 +166,7 @@
 
     def setUp(self):
         """Initialize"""
+        skip_if_no_ogr()
         self.session = Session("TestSession")
         self.filename = os.path.join("..","Data", "iceland","roads-line.shp")
         self.store_arc = OGRShapeStore(self.session, self.filename,



More information about the Thuban-commits mailing list