Skip to content

Commit

Permalink
Fix skipping of sjoin tests if rtree is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Aug 16, 2020
1 parent 8f573fb commit 8168caa
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions spatialpandas/tests/tools/test_sjoin.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,20 @@
from ..test_parquet import hyp_settings

try:
import rtree # noqa
gpd_spatialindex = True
except Exception:
from geopandas._compat import USE_PYGEOS, HAS_RTREE
gpd_spatialindex = USE_PYGEOS or HAS_RTREE
except:
try:
import pygeos # noqa
gpd_spatialindex = True
import rtree # noqa
gpd_spatialindex = rtree
except Exception:
gpd_spatialindex = False


@pytest.mark.skipIf(not gpd_spatialindex, reason='Geopandas spatialindex not available to compare against')
if not gpd_spatialindex:
pytest.skip('Geopandas spatialindex not available to compare against',
allow_module_level=True)


@given(
st_point_array(min_size=1, geoseries=True),
st_polygon_array(min_size=1, geoseries=True),
Expand Down

0 comments on commit 8168caa

Please sign in to comment.