def test_env_accessors_no_env(): """Sould all raise an exception.""" 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') expected = default_options.copy() expected.update({'foo': '1', 'bar': '2'}) assert getenv() == rasterio.env._env.options assert getenv() == expected assert get_gdal_config('foo') == '1' assert get_gdal_config('bar') == '2' delenv() with pytest.raises(EnvError): getenv() assert get_gdal_config('foo') is None assert get_gdal_config('bar') is None
def test_env_accessors(gdalenv): """High level GDAL env access.""" defenv() setenv(foo='1', bar='2') expected = default_options.copy() expected.update({'foo': '1', 'bar': '2'}) assert getenv() == rasterio.env.local._env.options assert getenv() == expected assert get_gdal_config('foo') == 1 assert get_gdal_config('bar') == 2 delenv() with pytest.raises(EnvError): getenv() assert get_gdal_config('foo') is None assert get_gdal_config('bar') is None
def test_env_accessors(gdalenv): """High level GDAL env access.""" defenv() setenv(foo='1', bar='2') expected = {'foo': '1', 'bar': '2'} items = getenv() assert items == rasterio.env.local._env.options # Comparison below requires removal of GDAL_DATA. items.pop('GDAL_DATA', None) assert items == expected assert get_gdal_config('foo') == 1 assert get_gdal_config('bar') == 2 delenv() with pytest.raises(EnvError): getenv() assert get_gdal_config('foo') is None assert get_gdal_config('bar') 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()