From 6480266e58c975df652c5505b2cc5dd17ee74145 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Feb 22 2020 04:49:31 +0000 Subject: Enable tests. --- diff --git a/52.patch b/52.patch new file mode 100644 index 0000000..b269f1b --- /dev/null +++ b/52.patch @@ -0,0 +1,75 @@ +From 5dd83276826313fe4fd06745ac1fce3811b40cd7 Mon Sep 17 00:00:00 2001 +From: Dani Arribas-Bel +Date: Fri, 18 Jan 2019 10:34:27 -0400 +Subject: [PATCH] Merge pull request #52 from jorisvandenbossche/searchsorted + +COMPAT: use numpy searchsorted +Signed-off-by: Elliott Sales de Andrade +--- + README.md | 1 - + contextily/tile.py | 17 ++++++++--------- + requirements.txt | 1 - + 3 files changed, 8 insertions(+), 11 deletions(-) + +diff --git a/README.md b/README.md +index 3672151..4c233a4 100644 +--- a/README.md ++++ b/README.md +@@ -24,7 +24,6 @@ the internet into geospatial raster files. Bounding boxes can be passed in both + * `cartopy` + * `mercantile` + * `numpy` +-* `pandas` + * `pillow` + * `rasterio` + * `six` +diff --git a/contextily/tile.py b/contextily/tile.py +index bffeb84..67d081d 100644 +--- a/contextily/tile.py ++++ b/contextily/tile.py +@@ -7,7 +7,6 @@ from six.moves.urllib.request import urlopen + import six + from PIL import Image + import numpy as np +-import pandas as pd + import rasterio as rio + from rasterio.transform import from_origin + from . import tile_providers as sources +@@ -196,14 +195,14 @@ def bb2wdw(bb, rtr): + ((row_start, row_stop), (col_start, col_stop)) + ''' + rbb = rtr.bounds +- xi = pd.Series(np.linspace(rbb.left, rbb.right, rtr.shape[1])) +- yi = pd.Series(np.linspace(rbb.bottom, rbb.top, rtr.shape[0])) +- +- window = ((rtr.shape[0] - yi.searchsorted(bb[3])[0], +- rtr.shape[0] - yi.searchsorted(bb[1])[0]), +- (xi.searchsorted(bb[0])[0], +- xi.searchsorted(bb[2])[0]) +- ) ++ xi = np.linspace(rbb.left, rbb.right, rtr.shape[1]) ++ yi = np.linspace(rbb.bottom, rbb.top, rtr.shape[0]) ++ ++ window = ((rtr.shape[0] - yi.searchsorted(bb[3]), ++ rtr.shape[0] - yi.searchsorted(bb[1])), ++ (xi.searchsorted(bb[0]), ++ xi.searchsorted(bb[2])) ++ ) + return window + + def _sm2ll(x, y): +diff --git a/requirements.txt b/requirements.txt +index 7c02b09..62aa9f0 100644 +--- a/requirements.txt ++++ b/requirements.txt +@@ -1,7 +1,6 @@ + cartopy + geopy + mercantile +-pandas + pillow + pytest + rasterio +-- +2.21.1 + diff --git a/python-contextily.spec b/python-contextily.spec index 0d1fe0e..7b2429d 100644 --- a/python-contextily.spec +++ b/python-contextily.spec @@ -1,5 +1,8 @@ %global srcname contextily +# Some tests require the network. +%bcond_with network + Name: python-%{srcname} Version: 0.99.0 Release: 1%{?dist} @@ -7,11 +10,21 @@ Summary: Context geo-tiles in Python License: BSD URL: https://github.com/darribas/contextily -Source0: %pypi_source +Source0: %{url}/archive/v%{version}/%{srcname}-%{version}.tar.gz +# Fix break due to Pandas change; remove Pandas as dep. +Patch0001: https://github.com/darribas/contextily/pull/52.patch + BuildArch: noarch BuildRequires: python3-devel BuildRequires: python3dist(setuptools) +BuildRequires: python3dist(cartopy) +BuildRequires: python3dist(geopy) +BuildRequires: python3dist(mercantile) +BuildRequires: python3dist(pillow) +BuildRequires: python3dist(pytest) +BuildRequires: python3dist(rasterio) +BuildRequires: python3dist(six) %description contextily is a small Python 3 package to retrieve and write to disk tile maps @@ -30,7 +43,7 @@ both WGS84 (EPSG:4326) and Spheric Mercator (EPSG:3857). %prep -%autosetup -n %{srcname}-%{version} +%autosetup -n %{srcname}-%{version} -p1 # Remove bundled egg-info rm -rf %{srcname}.egg-info @@ -41,6 +54,13 @@ rm -rf %{srcname}.egg-info %install %py3_install +%check +%if %{with network} +pytest-3 +%else +pytest-3 -k 'not test_bounds2raster and not test_bounds2img and not test_ll2wdw and not test_place and not test_plot_map' tests/test_ctx.py +%endif + %files -n python3-%{srcname} %license LICENSE.txt %doc README.md diff --git a/sources b/sources index e581b90..1a4c8c3 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (contextily-0.99.0.tar.gz) = 3bea53e063fffb2a581b1bdef652839e2e6b09a60096c341917318fd959cd3f45fc666256056486506e50370fd2aba5ff372c83e3519d0c919f91ae8b6483cd2 +SHA512 (contextily-0.99.0.tar.gz) = f60a02c291076e45c158fc3b61b3a51e2782c3f7deb08c2e52f19f23980a0fd92871ab00170cae30717a340fe4386d25bf64ece99c796bb5d6cf61918c331273