Skip to content

Commit

Permalink
Merge pull request #3256 from dopplershift/fix-apple-tests
Browse files Browse the repository at this point in the history
Make tests pass on macOS M2
  • Loading branch information
dcamron authored Nov 1, 2023
2 parents f8d2115 + 3056c18 commit 83308c3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
1 change: 1 addition & 0 deletions tests/calc/test_thermo.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ def test_moist_lapse_starting_points(start, direction):

@pytest.mark.xfail(platform.machine() == 'aarch64',
reason='ValueError is not raised on aarch64')
@pytest.mark.xfail(platform.machine() == 'arm64', reason='ValueError is not raised on Mac M2')
@pytest.mark.xfail(sys.platform == 'win32', reason='solve_ivp() does not error on Windows')
@pytest.mark.xfail(packaging.version.parse(scipy.__version__) < packaging.version.parse('1.7'),
reason='solve_ivp() does not error on Scipy < 1.7')
Expand Down
13 changes: 8 additions & 5 deletions tests/interpolate/test_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,14 @@ def test_find_nn_triangles_point():
tri = Delaunay(pts)

tri_match = tri.find_simplex([4.5, 4.5])
nn = find_nn_triangles_point(tri, tri_match, [4.5, 4.5])

# Can't rely on simplex indices, so need to check point indices
truth = {(45, 55, 44), (55, 54, 44)}
assert {tuple(verts) for verts in tri.simplices[nn]} == truth
nn = find_nn_triangles_point(tri, tri_match, (4.5, 4.5))

# Can't rely on simplex indices or the order of points that define them,
# so need to be a bit more involved to check
truth = [{45, 55, 44}, {55, 54, 44}]
found = [set(verts) for verts in tri.simplices[nn]]
for s in truth:
assert s in found


def test_find_local_boundary():
Expand Down
16 changes: 8 additions & 8 deletions tests/plots/test_declarative.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def test_declarative_four_dims_error():
pc.draw()


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.092)
@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.093)
@needs_cartopy
def test_declarative_contour():
"""Test making a contour plot."""
Expand Down Expand Up @@ -119,7 +119,7 @@ def test_declarative_contour():
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=False, tolerance=0.093)
@pytest.mark.mpl_image_compare(remove_text=False, tolerance=0.094)
@needs_cartopy
def test_declarative_titles():
"""Test making a contour plot with multiple titles."""
Expand Down Expand Up @@ -150,7 +150,7 @@ def test_declarative_titles():
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.072)
@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.098)
@needs_cartopy
def test_declarative_smooth_contour():
"""Test making a contour plot using smooth_contour."""
Expand Down Expand Up @@ -307,7 +307,7 @@ def test_declarative_smooth_field():
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.708)
@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.828)
@needs_cartopy
def test_declarative_contour_cam():
"""Test making a contour plot with CAM data."""
Expand Down Expand Up @@ -335,7 +335,7 @@ def test_declarative_contour_cam():


@pytest.mark.mpl_image_compare(remove_text=True,
tolerance=3.71 if mpl_version_before('3.8') else 0.026)
tolerance=3.71 if mpl_version_before('3.8') else 0.74)
@needs_cartopy
def test_declarative_contour_options():
"""Test making a contour plot."""
Expand Down Expand Up @@ -396,7 +396,7 @@ def test_declarative_layers_plot_options():


@pytest.mark.mpl_image_compare(remove_text=True,
tolerance=2.74 if mpl_version_before('3.8') else 0.014)
tolerance=2.74 if mpl_version_before('3.8') else 1.91)
@needs_cartopy
def test_declarative_contour_convert_units():
"""Test making a contour plot."""
Expand Down Expand Up @@ -426,7 +426,7 @@ def test_declarative_contour_convert_units():
return pc.figure


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.247)
@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.276)
@needs_cartopy
def test_declarative_events():
"""Test that resetting traitlets properly propagates."""
Expand Down Expand Up @@ -568,7 +568,7 @@ def test_no_field_error_barbs():
barbs.draw()


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.378)
@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.381)
def test_projection_object(ccrs, cfeature):
"""Test that we can pass a custom map projection."""
data = xr.open_dataset(get_test_data('narr_example.nc', as_file_obj=False))
Expand Down
2 changes: 1 addition & 1 deletion tests/plots/test_patheffects.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
StationaryFrontolysis, WarmFront, WarmFrontogenesis, WarmFrontolysis)


@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.)
@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.01)
def test_fronts():
"""Basic test of plotting fronts using path effects."""
x = np.linspace(0, 80, 5)
Expand Down

0 comments on commit 83308c3

Please sign in to comment.