From 6988ecb9467e46e326701798b6a1b43399d31152 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Apr 08 2020 23:13:56 +0000 Subject: Update to latest version. --- diff --git a/.gitignore b/.gitignore index 0376a4b..dd7db9e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /contextily-0.99.0.tar.gz /contextily-1.0~rc2.tar.gz +/contextily-1.0.0.tar.gz diff --git a/0001-Mark-tests-that-require-the-network.patch b/0001-Mark-tests-that-require-the-network.patch new file mode 100644 index 0000000..b095ca2 --- /dev/null +++ b/0001-Mark-tests-that-require-the-network.patch @@ -0,0 +1,161 @@ +From f23df735d90cb3593447711a61940a5cb8e781a8 Mon Sep 17 00:00:00 2001 +From: Elliott Sales de Andrade +Date: Thu, 5 Mar 2020 03:25:23 -0500 +Subject: [PATCH] Mark tests that require the network. + +Signed-off-by: Elliott Sales de Andrade +--- + tests/conftest.py | 3 +++ + tests/test_ctx.py | 12 ++++++++++++ + tests/test_providers.py | 4 ++++ + 3 files changed, 19 insertions(+) + create mode 100644 tests/conftest.py + +diff --git a/tests/conftest.py b/tests/conftest.py +new file mode 100644 +index 0000000..f7dcea5 +--- /dev/null ++++ b/tests/conftest.py +@@ -0,0 +1,3 @@ ++def pytest_configure(config): ++ config.addinivalue_line("markers", ++ "network: mark tests that use the network.") +diff --git a/tests/test_ctx.py b/tests/test_ctx.py +index 26107d4..f1a7eb9 100644 +--- a/tests/test_ctx.py ++++ b/tests/test_ctx.py +@@ -5,6 +5,7 @@ import contextily as ctx + import os + import numpy as np + import mercantile as mt ++import pytest + import rasterio as rio + from contextily.tile import _calculate_zoom + from numpy.testing import assert_array_almost_equal +@@ -17,6 +18,7 @@ ADJUST = -3 # To save download size / time + # Tile + + ++@pytest.mark.network + def test_bounds2raster(): + w, s, e, n = ( + -106.6495132446289, +@@ -66,6 +68,7 @@ def test_bounds2raster(): + assert_array_almost_equal(list(rtr.bounds), rtr_bounds) + + ++@pytest.mark.network + def test_bounds2img(): + w, s, e, n = ( + -106.6495132446289, +@@ -87,6 +90,7 @@ def test_bounds2img(): + assert img[200, 100, :].tolist() == [230, 225, 189] + + ++@pytest.mark.network + def test_warp_tiles(): + w, s, e, n = ( + -106.6495132446289, +@@ -112,6 +116,7 @@ def test_warp_tiles(): + assert wimg[200, 100, :].tolist() == [133, 130, 109] + + ++@pytest.mark.network + def test_warp_img_transform(): + w, s, e, n = ext = ( + -106.6495132446289, +@@ -143,6 +148,7 @@ def test_howmany(): + assert got == expected + + ++@pytest.mark.network + def test_ll2wdw(): + w, s, e, n = ( + -106.6495132446289, +@@ -181,6 +187,7 @@ def test_autozoom(): + assert zoom == expected_zoom + + ++@pytest.mark.network + def test_validate_zoom(): + # tiny extent to trigger large calculated zoom + w, s, e, n = (0, 0, 0.001, 0.001) +@@ -206,6 +213,7 @@ def test_validate_zoom(): + # Place + + ++@pytest.mark.network + def test_place(): + expected_bbox = [-105.3014509, 39.9643513, -105.1780988, 40.094409] + expected_bbox_map = [ +@@ -237,6 +245,7 @@ def test_place(): + assert_array_almost_equal(loc.bbox_map, ax.images[0].get_extent()) + + ++@pytest.mark.network + def test_plot_map(): + # Place as a search + loc = ctx.Place(SEARCH, zoom_adjust=ADJUST) +@@ -256,6 +265,7 @@ def test_plot_map(): + # Plotting + + ++@pytest.mark.network + def test_add_basemap(): + # Plot boulder bbox as in test_place + x1, x2, y1, y2 = [ +@@ -366,6 +376,7 @@ def test_add_basemap(): + assert_array_almost_equal(ax.images[0].get_array().mean(), 183.38608756727749) + + ++@pytest.mark.network + def test_basemap_attribution(): + extent = (-11945319, -10336026, 2910477, 4438236) + +@@ -417,6 +428,7 @@ def test_attribution(): + assert txt.get_fontfamily() == ["monospace"] + + ++@pytest.mark.network + def test_set_cache_dir(tmpdir): + # set cache directory manually + path = str(tmpdir.mkdir("cache")) +diff --git a/tests/test_providers.py b/tests/test_providers.py +index 1389bea..e91ae61 100644 +--- a/tests/test_providers.py ++++ b/tests/test_providers.py +@@ -5,6 +5,7 @@ import pytest + from numpy.testing import assert_allclose + + ++@pytest.mark.network + def test_sources(): + # NOTE: only tests they download, does not check pixel values + w, s, e, n = ( +@@ -18,6 +19,7 @@ def test_sources(): + img, ext = ctx.bounds2img(w, s, e, n, 4, source=getattr(tilers, src), ll=True) + + ++@pytest.mark.network + def test_deprecated_url_format(): + old_url = "http://a.tile.openstreetmap.org/tileZ/tileX/tileY.png" + new_url = "http://a.tile.openstreetmap.org/{z}/{x}/{y}.png" +@@ -37,6 +39,7 @@ def test_deprecated_url_format(): + assert_allclose(ext1, ext2) + + ++@pytest.mark.network + def test_providers(): + # NOTE: only tests they download, does not check pixel values + w, s, e, n = ( +@@ -77,6 +80,7 @@ def test_provider_attribute_access(): + provider.non_existing_key + + ++@pytest.mark.network + def test_url(): + # NOTE: only tests they download, does not check pixel values + w, s, e, n = ( +-- +2.21.1 + diff --git a/dc6746f4499bd46750e96da6b534d23f13e7be65.patch b/dc6746f4499bd46750e96da6b534d23f13e7be65.patch deleted file mode 100644 index 56d1d63..0000000 --- a/dc6746f4499bd46750e96da6b534d23f13e7be65.patch +++ /dev/null @@ -1,86 +0,0 @@ -From dc6746f4499bd46750e96da6b534d23f13e7be65 Mon Sep 17 00:00:00 2001 -From: Andy Eschbacher -Date: Sat, 7 Sep 2019 06:31:10 -0400 -Subject: [PATCH] updates example to work with renamed function (#98) - -* updates example to work with renamed function - -* Change test for add_basemap to accommodate errors after apparent change in stament tiles - -* Replace assert for assert_array_almost_equal in test_warp_tiles ---- - examples/plot_map.py | 3 +-- - tests/test_ctx.py | 29 +++++++++++++++-------------- - 2 files changed, 16 insertions(+), 16 deletions(-) - -diff --git a/examples/plot_map.py b/examples/plot_map.py -index 67d8012..5ab0249 100644 ---- a/examples/plot_map.py -+++ b/examples/plot_map.py -@@ -46,8 +46,7 @@ - # You can also grab tile information directly from a bounding box + zoom level. - # This is demoed below: - --zoom = ctx.calculate_zoom(loc.w, loc.s, loc.e, loc.n) --im2, bbox = ctx.bounds2img(loc.w, loc.s, loc.e, loc.n, zoom=zoom, ll=True) -+im2, bbox = ctx.bounds2img(loc.w, loc.s, loc.e, loc.n, zoom=loc.zoom, ll=True) - ctx.plot_map(im2, bbox, ax=axs[2], title="Boulder, CO") - - plt.show() -diff --git a/tests/test_ctx.py b/tests/test_ctx.py -index d6e130b..3628dee 100644 ---- a/tests/test_ctx.py -+++ b/tests/test_ctx.py -@@ -95,12 +95,13 @@ def test_warp_tiles(): - ) - img, ext = ctx.bounds2img(w, s, e, n, zoom=4, ll=True) - wimg, wext = ctx.warp_tiles(img, ext) -- assert wext == ( -- -112.54394531249996, -- -90.07903186397023, -- 21.966726124122374, -- 41.013065787006276, -- ) -+ assert_array_almost_equal(np.array(wext), \ -+ np.array([-112.54394531249996, -+ -90.07903186397023, -+ 21.966726124122374, -+ 41.013065787006276 -+ ]) -+ ) - assert wimg[100, 100, :].tolist() == [228, 221, 184] - assert wimg[100, 200, :].tolist() == [213, 219, 177] - assert wimg[200, 100, :].tolist() == [133, 130, 109] -@@ -247,9 +248,9 @@ def test_add_basemap(): - ax_extent = (x1, x2, y1, y2) - assert ax.axis() == ax_extent - -- assert ax.images[0].get_array().sum() == 75853866 -- assert ax.images[0].get_array().shape == (256, 512, 3) -- assert_array_almost_equal(ax.images[0].get_array().mean(), 192.90635681152344) -+ assert ax.images[0].get_array().sum() == 34840247 -+ assert ax.images[0].get_array().shape == (256, 256, 3) -+ assert_array_almost_equal(ax.images[0].get_array().mean(), 177.20665995279947) - - # Test local source - f, ax = matplotlib.pyplot.subplots(1) -@@ -277,14 +278,14 @@ def test_add_basemap(): - - ax_extent = ( - -11740727.544603072, -- -11691807.846500559, -- 4852834.0517692715, -+ -11701591.786121061, -+ 4852834.051769271, - 4891969.810251278, - ) - assert_array_almost_equal(ax_extent, ax.images[0].get_extent()) -- assert ax.images[0].get_array().sum() == 723918764 -- assert ax.images[0].get_array().shape == (1024, 1280, 3) -- assert_array_almost_equal(ax.images[0].get_array().mean(), 184.10206197102863) -+ assert ax.images[0].get_array().sum() == 563185119 -+ assert ax.images[0].get_array().shape == (1024, 1024, 3) -+ assert_array_almost_equal(ax.images[0].get_array().mean(), 179.03172779083252) - - # Test on-th-fly warping - x1, x2 = -105.5, -105.00 diff --git a/python-contextily.spec b/python-contextily.spec index 95fdebb..36133b6 100644 --- a/python-contextily.spec +++ b/python-contextily.spec @@ -1,19 +1,18 @@ %global srcname contextily -%global version_ 1.0rc2 # Some tests require the network. %bcond_with network Name: python-%{srcname} -Version: 1.0~rc2 +Version: 1.0.0 Release: 1%{?dist} Summary: Context geo-tiles in Python License: BSD -URL: https://github.com/darribas/contextily -Source0: %{url}/archive/v%{version_}/%{srcname}-%{version}.tar.gz -# Fix tests https://github.com/darribas/contextily/pull/98 -Patch0001: https://github.com/darribas/contextily/commit/dc6746f4499bd46750e96da6b534d23f13e7be65.patch +URL: https://github.com/geopandas/contextily +Source0: %{url}/archive/v%{version}/%{srcname}-%{version}.tar.gz +# https://github.com/geopandas/contextily/pull/124 +Patch0001: 0001-Mark-tests-that-require-the-network.patch BuildArch: noarch @@ -45,7 +44,7 @@ both WGS84 (EPSG:4326) and Spheric Mercator (EPSG:3857). %prep -%autosetup -n %{srcname}-%{version_} -p1 +%autosetup -n %{srcname}-%{version} -p1 # Remove bundled egg-info rm -rf %{srcname}.egg-info @@ -60,29 +59,19 @@ rm -rf %{srcname}.egg-info %if %{with network} pytest-3 %else -pytest-3 \ - -k 'not test_add_basemap and \ - not test_basemap_attribution and \ - not test_bounds2img and \ - not test_bounds2raster and \ - not test_ll2wdw and \ - not test_place and \ - not test_plot_map and \ - not test_warp_img_transform and \ - not test_warp_tiles' \ - tests/test_ctx.py -pytest-3 \ - -k 'test_providers_callable or test_invalid_provider or test_provider_attribute_access' \ - tests/test_providers.py +pytest-3 -m 'not network' %endif %files -n python3-%{srcname} %license LICENSE.txt %doc README.md %{python3_sitelib}/%{srcname} -%{python3_sitelib}/%{srcname}-%{version_}-py*.egg-info +%{python3_sitelib}/%{srcname}-%{version}-py*.egg-info %changelog +* Wed Apr 08 2020 Elliott Sales de Andrade - 1.0.0-1 +- Update to latest version + * Sat Feb 22 2020 Elliott Sales de Andrade - 1.0~rc2-1 - Update to latest release candidate diff --git a/sources b/sources index fb7df41..bb34ec1 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (contextily-1.0~rc2.tar.gz) = 01f573196b7c9ca89bf4d917a93612266c7bf69b9d1c52b7cc22190be3960145cb7ffd8c71be926e586498e187585eca9d581129a1c41112f4c32f3970bd12a2 +SHA512 (contextily-1.0.0.tar.gz) = 0f9f01b899909e687eaf3b6ae2567b3a3d1dfbba441262ed61f18a3346a679a65102ebb781f66af1ac78255efc1542954f122caaa828bbeaf45545f9e84c6d68