rasterio/tests/test_data_paths.py
Sean Gillies 36786d5886
GDAL 3.0.x support in code but not wheels (#1729)
* Added support for Proj6 and GDAL 3

* install proj6

* build proj with local installation dir

* conditional proj dependency

* added proj4 flags for all gdal versions

* Restore debian data tests

* Version specific proj configuration

* Fix string comp expression

* Explicit matrix

* Restructure build matrix

* Remove wait from proj build script

* Call script with bash

* Fix version text

* Bash syntax

* Correct PROJOPTs

* Use xvfb service

* Back to proj 4.8 for older GDAL

* Fix syntax error

* Add verbosity to tests

* Take proj off library path, remove gdal-bin package

* Install PROJ and GDAL to same prefix

* Set up runtime env

* Try 4.9.3

* Source build scripts

* Switch to case for versions

* set trace

* Test existence of share/gdal directory

The proj install script created the gdal install directory so a
test for just that is not sufficient.

* Test for share/proj

* Run tests under gdb

* Forgot the run command

* Wait 20 for GDAL

* travis_wait

* Restructure build script, less boilerplate

* Back to trusty

* dist: trusty

* Remove gdb

* Allow 3.0.1/6.1.1 to fail, some changes since 3.0.0/6.1.0
2019-07-26 13:46:55 -06:00

54 lines
1.5 KiB
Python

"""Tests of GDAL and PROJ data finding"""
import os.path
from click.testing import CliRunner
import pytest
import rasterio
from rasterio._env import GDALDataFinder, PROJDataFinder
from .conftest import requires_gdal_lt_3
from rasterio.rio.main import main_group
@requires_gdal_lt_3
@pytest.mark.wheel
def test_gdal_data():
"""Get GDAL data path from a wheel"""
assert GDALDataFinder().search() == os.path.join(os.path.dirname(rasterio.__file__), 'gdal_data')
def test_gdal_data_find_file():
"""Find_file shouldn't raise any exceptions"""
GDALDataFinder().find_file("header.dxf")
@requires_gdal_lt_3
@pytest.mark.wheel
def test_proj_data():
"""Get GDAL data path from a wheel"""
assert PROJDataFinder().search() == os.path.join(os.path.dirname(rasterio.__file__), 'proj_data')
def test_proj_data_has_data():
"""has_data shouldn't raise any exceptions"""
PROJDataFinder().has_data()
@requires_gdal_lt_3
@pytest.mark.wheel
def test_env_gdal_data():
runner = CliRunner()
result = runner.invoke(main_group, ['env', '--gdal-data'])
assert result.exit_code == 0
assert result.output.strip() == os.path.join(os.path.dirname(rasterio.__file__), 'gdal_data')
@requires_gdal_lt_3
@pytest.mark.wheel
def test_env_proj_data():
runner = CliRunner()
result = runner.invoke(main_group, ['env', '--proj-data'])
assert result.exit_code == 0
assert result.output.strip() == os.path.join(os.path.dirname(rasterio.__file__), 'proj_data')