Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MNT: Drop Python 3.4 from test matrix #926

Merged
merged 11 commits into from
Nov 27, 2017
20 changes: 12 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@ language: python

env:
matrix:
# These ancient versions are linked to an old libgfortran, but that version
# isn't pinned in the package metadata
# Forcing build 3 for numpy pulls in the packages from defaults, which
# is needed in order to work with libgfortran 1
- PYTHON_VERSION=2.7
PACKAGES="numpy=1.7.1 matplotlib=1.3.1 nose scipy=0.12.0 mock"
- PYTHON_VERSION=3.4
PACKAGES="numpy=1.8.2 matplotlib=1.3.1 nose scipy=0.14.0"
PACKAGES="numpy=1.9.3=py27_3 matplotlib=1.4.3 nose scipy=0.16.0 libgfortran=1 mock"
- PYTHON_VERSION=3.5
PACKAGES="numpy=1.9.3=py35_3 matplotlib=1.4.3 nose scipy=0.16.0 libgfortran=1"
# Remove nose from latest packages when Matplotlib 2.1 is released.
- NAME="Latest everything."
PYTHON_VERSION=3.5
PACKAGES="numpy matplotlib nose scipy"
PYTHON_VERSION=3.6
PACKAGES="numpy matplotlib<2.1 nose scipy"
- NAME="Latest everything (py2k)."
PYTHON_VERSION=2
PACKAGES="numpy matplotlib nose scipy mock"
PACKAGES="numpy matplotlib<2.1 nose scipy mock"


sudo: false
Expand All @@ -26,9 +30,9 @@ install:
# Install miniconda
# -----------------
- if [[ "$PYTHON_VERSION" == 2* ]]; then
wget http://repo.continuum.io/miniconda/Miniconda-3.7.0-Linux-x86_64.sh -O miniconda.sh;
wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh -O miniconda.sh;
else
wget http://repo.continuum.io/miniconda/Miniconda3-3.7.0-Linux-x86_64.sh -O miniconda.sh;
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
fi
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
Expand Down
2 changes: 1 addition & 1 deletion lib/cartopy/tests/mpl/test_crs.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
def test_lambert_south():
# Reference image: http://www.icsm.gov.au/mapping/map_projections.html
crs = ccrs.LambertConformal(central_longitude=140, cutoff=65,
secant_latitudes=(-30, -60))
standard_parallels=(-30, -60))
ax = plt.axes(projection=crs)
ax.coastlines()
ax.gridlines()
Expand Down
2 changes: 1 addition & 1 deletion lib/cartopy/tests/mpl/test_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
# The basemap changes on a regular basis (for seasons) and we really only
# care that it is putting images onto the map which are roughly correct.
@ImageTesting(['web_tiles'],
tolerance=12 if MPL_VERSION < '2' else 2)
tolerance=12 if MPL_VERSION < '2' else 2.9)
def test_web_tiles():
extent = [-15, 0.1, 50, 60]
target_domain = sgeom.Polygon([[extent[0], extent[1]],
Expand Down
12 changes: 6 additions & 6 deletions lib/cartopy/tests/mpl/test_mpl_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
from cartopy.tests.mpl import MPL_VERSION, ImageTesting


_ROB_TOL = 0.5 if ccrs.PROJ4_VERSION < (4, 9) else 0.1
_ROB_TOL = 0.5 if ccrs.PROJ4_VERSION < (4, 9) else 0.111
if MPL_VERSION >= '2':
_STREAMPLOT_IMAGE = 'streamplot'
elif MPL_VERSION >= '1.5':
_STREAMPLOT_IMAGE = 'streamplot_1.5'
elif MPL_VERSION >= '1.4.3':
_STREAMPLOT_IMAGE = 'streamplot_1.4.3'
else:
_STREAMPLOT_IMAGE = 'streamplot_pre_mpl_1.5'
_STREAMPLOT_IMAGE = 'streamplot_pre_mpl_1.4.3'


@ImageTesting(['global_contour_wrap'])
Expand Down Expand Up @@ -77,8 +77,8 @@ def test_global_contourf_wrap_no_transform():


global_pcolor_wrap = ('global_pcolor_wrap'
if mpl.__version__ >= '1.5' else
'global_pcolor_wrap_pre_mpl_1.5')
if mpl.__version__ >= '1.4.3' else
'global_pcolor_wrap_pre_mpl_1.4.3')


@ImageTesting([global_pcolor_wrap])
Expand Down
1 change: 1 addition & 0 deletions lib/cartopy/tests/mpl/test_quiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def setup_method(self):
self.v = np.cos(2. * np.deg2rad(self.x2d))
self.rp = ccrs.RotatedPole(pole_longitude=177.5, pole_latitude=37.5)
self.pc = ccrs.PlateCarree()
self.fig = plt.figure()
self.ax = plt.axes(projection=self.pc)

@cleanup
Expand Down
6 changes: 3 additions & 3 deletions lib/cartopy/tests/mpl/test_set_extent.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ def test_extents():
uk = [-12.5, 4, 49, 60]
uk_crs = ccrs.Geodetic()

ax = plt.axes(projection=ccrs.PlateCarree())
ax = plt.axes(projection=ccrs.PlateCarree(), label='pc')
ax.set_extent(uk, crs=uk_crs)
# enable to see what is going on (and to make sure it is a plot of the uk)
# ax.coastlines()
assert_array_almost_equal(ax.viewLim.get_points(),
np.array([[-12.5, 49.], [4., 60.]]))

ax = plt.axes(projection=ccrs.NorthPolarStereo())
ax = plt.axes(projection=ccrs.NorthPolarStereo(), label='npstere')
ax.set_extent(uk, crs=uk_crs)
# enable to see what is going on (and to make sure it is a plot of the uk)
# ax.coastlines()
Expand All @@ -51,7 +51,7 @@ def test_extents():

# given that we know the PolarStereo coordinates of the UK, try using
# those in a PlateCarree plot
ax = plt.axes(projection=ccrs.PlateCarree())
ax = plt.axes(projection=ccrs.PlateCarree(), label='pc')
ax.set_extent([-1034046, 333263, -4765889, -3345219],
crs=ccrs.NorthPolarStereo())
# enable to see what is going on (and to make sure it is a plot of the uk)
Expand Down
9 changes: 6 additions & 3 deletions lib/cartopy/tests/test_crs.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import pickle

import numpy as np
from numpy.testing import assert_almost_equal
from numpy.testing import assert_array_almost_equal as assert_arr_almost_eq
try:
import pyepsg
Expand Down Expand Up @@ -88,9 +89,11 @@ def test_osgb(self):
def test_epsg(self):
uk = ccrs.epsg(27700)
assert uk.epsg_code == 27700
assert uk.x_limits == (-84667.135022467062, 676354.14167904819)
assert uk.y_limits == (-2957.1831134535023, 1242951.4397385279)
assert uk.threshold == 7610.2127670151531
assert_almost_equal(uk.x_limits,
(-84667.135022467062, 676354.14167904819))
assert_almost_equal(uk.y_limits,
(-2957.1831134535023, 1242951.4397385279))
assert_almost_equal(uk.threshold, 7610.2127670151531)
self._check_osgb(uk)

def test_europp(self):
Expand Down
30 changes: 19 additions & 11 deletions lib/cartopy/tests/test_polygon.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,13 @@ def test_plate_carree_partial_wrap(self):
# Check the structure
assert len(multi_polygon) == 2
# Check the rough shape
polygon = multi_polygon[0]
self._assert_bounds(polygon.bounds, 170, 0, 180, 10)
polygon = multi_polygon[1]
self._assert_bounds(polygon.bounds, -180, 0, -170, 10)
poly1, poly2 = multi_polygon
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was sooo annoying.

# The order of these polygons is not guaranteed, so figure out
# which is appropriate
if 170.0 not in poly1.bounds:
poly1, poly2 = poly2, poly1
self._assert_bounds(poly1.bounds, 170, 0, 180, 10)
self._assert_bounds(poly2.bounds, -180, 0, -170, 10)

def test_plate_carree_wrap(self):
proj = ccrs.PlateCarree()
Expand Down Expand Up @@ -312,14 +315,19 @@ def test_wrapped_poly_simple_hole(self):
multi_polygon = proj.project_geometry(poly)
# Check the structure
assert len(multi_polygon) == 2
assert len(multi_polygon[0].interiors) == 1
assert len(multi_polygon[1].interiors) == 0

poly1, poly2 = multi_polygon
# The order of these polygons is not guaranteed, so figure out
# which is appropriate
if not len(poly1.interiors) == 1:
poly1, poly2 = poly2, poly1

assert len(poly1.interiors) == 1
assert len(poly2.interiors) == 0
# Check the rough shape
polygon = multi_polygon[0]
self._assert_bounds(polygon.bounds, 110, -47, 180, 47)
self._assert_bounds(polygon.interiors[0].bounds, 130, -21, 170, 21)
polygon = multi_polygon[1]
self._assert_bounds(polygon.bounds, -180, -43, -170, 43)
self._assert_bounds(poly1.bounds, 110, -47, 180, 47)
self._assert_bounds(poly1.interiors[0].bounds, 130, -21, 170, 21)
self._assert_bounds(poly2.bounds, -180, -43, -170, 43)

def test_wrapped_poly_wrapped_hole(self):
proj = ccrs.PlateCarree(-180)
Expand Down