[gdal-dev] Test Data

Even Rouault even.rouault at spatialys.com
Mon Apr 26 15:03:28 PDT 2021


GDAL_DATA is evaluated as the argument of fopen(), so if it is relative, 
you need to be a current directory consistent with the relative path for 
it to work. You'd generally want ot use an absolute path for GDAL_DATA

I see that in pytest.ini a commented line with #GDAL_DATA = 
../gdal/data. And autotest/conftest.py has logic to chdir() in the 
directory where each test is run, and it happens our arborescence of 
test is autotest/foo, so the value of ../gdal/data does not work. It 
should rather be ../../gdal/data . We should probably fix that line, but 
I'm wondering if it is a good idea to set it at all in pytest.ini. A dev 
environment without GDAL_DATA set wouldn't be functional outside of 
pytest. A nice improvement would be to detect that we run from a dev 
environment and automatically figure out the GDAL_DATA directory from 
that (qgis has some magic for similar situation), but that might be 
fragile and need a bit of rework if some day we use another build system :-)

Le 26/04/2021 à 23:51, Andrew Bell a écrit :
>
>
> On Mon, Apr 26, 2021 at 10:44 AM Even Rouault 
> <even.rouault at spatialys.com <mailto:even.rouault at spatialys.com>> wrote:
>
>     DGN writing indeeds need GDAL_DATA to be set and point to the
>     directory that contains seed_2d.dgn
>
> Is it the case that GDAL_DATA is relative to the directory containing 
> the test rather than the test driver directory (autotest)? Changing a 
> relative path to an absolute one allowed the seed file to be found. 
> This seemed strange because the provided pytest.ini contains a 
> relative path. Is there some other variable that sets the base path to 
> be used?
>
> Thanks,
>
> -- 
> Andrew Bell
> andrew.bell.ia at gmail.com <mailto:andrew.bell.ia at gmail.com>

-- 
http://www.spatialys.com
My software is free, but my time generally not.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20210427/0cad3adf/attachment.html>


More information about the gdal-dev mailing list