Skip to content

Commit

Permalink
Gdal23 fixes (#576)
Browse files Browse the repository at this point in the history
* remove silent option for gdal make as it might lead to timeouts on travis

* skip test_grenada_bytes_geojson for gdal >= 2.3.0

* missing import

* switch to get_gdal_version_num

* cleanup

* print also gdal version number

* pytest strcit

* missing @

* pytest --strict requires markes to be registred

* add scheme to path

* move svn.osgeo.org to github

* wrong url change

* case destinction remote schemes
  • Loading branch information
rbuffat authored and sgillies committed Apr 22, 2018
1 parent d055579 commit f70b44c
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 12 deletions.
6 changes: 5 additions & 1 deletion fiona/vfs.py
Expand Up @@ -57,7 +57,11 @@ def parse_paths(uri, vfs=None):
scheme = parts.scheme
path = parts.path
if parts.netloc and parts.netloc != 'localhost':
path = parts.netloc + path
if scheme.split("+")[-1] in REMOTESCHEMES:
# We need to deal with cases such as zip+https://server.com/data.zip
path = "{}://{}{}".format(scheme.split("+")[-1], parts.netloc, path)
else:
path = parts.netloc + path
if scheme in SCHEMES:
parts = path.split('!')
path = parts.pop() if parts else None
Expand Down
4 changes: 2 additions & 2 deletions scripts/travis_gdal_install.sh
Expand Up @@ -58,7 +58,7 @@ if [ "$GDALVERSION" = "trunk" ]; then
git clone -b master --single-branch --depth=1 https://github.com/OSGeo/gdal.git $GDALBUILD/trunk
cd $GDALBUILD/trunk/gdal
./configure --prefix=$GDALINST/gdal-$GDALVERSION $GDALOPTS
make -s -j 2
make -j 2
make install
elif [ ! -d "$GDALINST/gdal-$GDALVERSION" ]; then
# only build if not already installed
Expand All @@ -67,7 +67,7 @@ elif [ ! -d "$GDALINST/gdal-$GDALVERSION" ]; then
tar -xzf gdal-$GDALVERSION.tar.gz
cd gdal-$GDALVERSION
./configure --prefix=$GDALINST/gdal-$GDALVERSION $GDALOPTS
make -s -j 2
make -j 2
make install
fi

Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Expand Up @@ -14,7 +14,7 @@ def pytest_report_header(config):
headers = []
# gdal version number
gdal_release_name = fiona.get_gdal_release_name().decode("utf-8")
headers.append('GDAL: {}'.format(gdal_release_name))
headers.append('GDAL: {} ({})'.format(gdal_release_name, fiona.get_gdal_version_num()))
supported_drivers = ", ".join(sorted(list(fiona.supported_drivers.keys())))
# supported drivers
headers.append("Supported drivers: {}".format(supported_drivers))
Expand Down
6 changes: 3 additions & 3 deletions tests/test_bytescollection.py
Expand Up @@ -9,8 +9,6 @@
import fiona

@pytest.mark.usefixtures('uttc_path_coutwildrnp_json')


class ReadingTest(unittest.TestCase):

def setUp(self):
Expand Down Expand Up @@ -221,7 +219,9 @@ def test_zipped_bytes_collection(bytes_coutwildrnp_zip):
assert col.name == 'coutwildrnp'
assert len(col) == 67


@pytest.mark.skipif(fiona.get_gdal_version_num() >= fiona.calc_gdal_version_num(2, 3, 0),
reason="Changed behavior with gdal 2.3, possibly related to RFC 70:"
"Guessing output format from output file name extension for utilities")
def test_grenada_bytes_geojson(bytes_grenada_geojson):
"""Read grenada.geojson as BytesCollection.
Expand Down
8 changes: 4 additions & 4 deletions tests/test_collection.py
Expand Up @@ -922,13 +922,13 @@ def tearDown(self):

@pytest.mark.network
def test_collection_http():
ds = fiona.Collection('http://svn.osgeo.org/gdal/trunk/autotest/ogr/data/poly.shp', vsi='http')
assert ds.path == '/vsicurl/http://svn.osgeo.org/gdal/trunk/autotest/ogr/data/poly.shp'
ds = fiona.Collection('http://raw.githubusercontent.com/OSGeo/gdal/master/autotest/ogr/data/poly.shp', vsi='http')
assert ds.path == '/vsicurl/http://raw.githubusercontent.com/OSGeo/gdal/master/autotest/ogr/data/poly.shp'
assert len(ds) == 10

@pytest.mark.network
def test_collection_zip_http():
ds = fiona.Collection('http://svn.osgeo.org/gdal/trunk/autotest/ogr/data/poly.zip', vsi='zip+http')
assert ds.path == '/vsizip/vsicurl/http://svn.osgeo.org/gdal/trunk/autotest/ogr/data/poly.zip'
ds = fiona.Collection('http://raw.githubusercontent.com/OSGeo/gdal/master/autotest/ogr/data/poly.zip', vsi='zip+http')
assert ds.path == '/vsizip/vsicurl/http://raw.githubusercontent.com/OSGeo/gdal/master/autotest/ogr/data/poly.zip'
assert len(ds) == 10

2 changes: 1 addition & 1 deletion tests/test_vfs.py
Expand Up @@ -162,7 +162,7 @@ def test_path(self):

@pytest.mark.network
def test_open_http():
ds = fiona.open('http://svn.osgeo.org/gdal/trunk/autotest/ogr/data/poly.shp')
ds = fiona.open('https://raw.githubusercontent.com/OSGeo/gdal/master/autotest/ogr/data/poly.shp')
assert len(ds) == 10

@credentials
Expand Down

0 comments on commit f70b44c

Please sign in to comment.