[mapserver-dev] msautotest-wxs: how to suppress the header information?

Normand Savard nsavard at mapgears.com
Tue Mar 17 10:10:23 EDT 2009


Tamas Szekeres wrote:
> Hi All,
>
> I'm wondering how the msautotest should be executed on windows. Currently I
> get much of the failures because mapserv provides the result with the
> content-type included at the beginning of each file (including the png-s)
> which is compared to the expected files without having that extra
> information.
> Is there a way to suppress this header inclusion without touching the code?
> (I know mapserv has the '-nh' option but it seems mstestlib.py should be
> changed to include this switch)
>
>
>   
Tamas,

I checked how the tests works in mstestlib.py and the generated output.  
When it's an wxs tests, if the output result is a png file, it's passed 
through the demime_file() function.  This function is called when  
[RESULT_DEMIME] is part of the RUN_PARMS request.  It removes the 
Content-type.

For the other tests like the ones in gdal or misc, shp2img is used and 
there is no such thing as Content-type in the png generated.

Maybe I'm missing something so please do not hesitate to comment.

Norm



def demime_file( filename ):

   data = open(filename,'rb').read()

   for i in range(len(data)-1):
       if data[i] == '\n' and data[i+1] == '\n':
           open(filename,'wb').write(data[i+2:])
           return
   return


More information about the mapserver-dev mailing list