[mapserver-commits] r11085 - trunk/msautotest/pymod

svn at osgeo.org svn at osgeo.org
Sun Mar 6 07:33:14 EST 2011


Author: rouault
Date: 2011-03-06 04:33:14 -0800 (Sun, 06 Mar 2011)
New Revision: 11085

Modified:
   trunk/msautotest/pymod/testlib.py
Log:
Fix GDAL usage in testlib.py/compare_result()

Modified: trunk/msautotest/pymod/testlib.py
===================================================================
--- trunk/msautotest/pymod/testlib.py	2011-03-06 12:15:20 UTC (rev 11084)
+++ trunk/msautotest/pymod/testlib.py	2011-03-06 12:33:14 UTC (rev 11085)
@@ -59,20 +59,23 @@
     # Check image checksums with GDAL if it is available.
     
     try:
-	import osgeo.gdal
-        gdal.PushErrorHandler()
-	exp_ds = gdal.Open( expected_file )
+        try:
+            from osgeo import gdal
+        except:
+            import gdal
+        gdal.PushErrorHandler('CPLQuietErrorHandler')
+        exp_ds = gdal.Open( expected_file )
         gdal.PopErrorHandler()
         if exp_ds == None:
             return 'nomatch'
         
-	res_ds = gdal.Open( result_file )
+        res_ds = gdal.Open( result_file )
 
         match = 1
-	for band_num in range(1,exp_ds.RasterCount+1):
-	    if res_ds.GetRasterBand(band_num).Checksum() != \
-                exp_ds.GetRasterBand(band_num).Checksum():
-		match = 0
+        for band_num in range(1,exp_ds.RasterCount+1):
+            if res_ds.GetRasterBand(band_num).Checksum() != \
+               exp_ds.GetRasterBand(band_num).Checksum():
+                match = 0
 
         if match == 1:
             return 'files_differ_image_match'



More information about the mapserver-commits mailing list