def test_gdal_config_accessers(): """Low level GDAL config access.""" assert get_gdal_config('foo') is None set_gdal_config('foo', 'bar') assert get_gdal_config('foo') == 'bar' del_gdal_config('foo') assert get_gdal_config('foo') is None
def test_env_accessors(gdalenv): """High level GDAL env access""" defenv() setenv(foo='1', bar='2') assert getenv() == rasterio.env._env.options == {'foo': '1', 'bar': '2'} assert get_gdal_config('foo') == '1' assert get_gdal_config('bar') == '2' delenv() assert getenv() == rasterio.env._env.options == {} assert get_gdal_config('foo') is None assert get_gdal_config('bar') is None rasterio.env._env = None with pytest.raises(EnvError): delenv() with pytest.raises(EnvError): setenv() with pytest.raises(EnvError): getenv()
def test_env_accessors(gdalenv): """High level GDAL env access.""" defenv() setenv(foo='1', bar='2') assert getenv() == rasterio.env._env.options == {'foo': '1', 'bar': '2'} assert get_gdal_config('foo') == '1' assert get_gdal_config('bar') == '2' delenv() assert getenv() == rasterio.env._env.options == {} assert get_gdal_config('foo') is None assert get_gdal_config('bar') is None rasterio.env._env = None with pytest.raises(EnvError): delenv() with pytest.raises(EnvError): setenv() with pytest.raises(EnvError): getenv()