Ejemplo n.º 1
0
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
Ejemplo n.º 2
0
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
Ejemplo n.º 3
0
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()
Ejemplo n.º 4
0
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()