From d7a28cd5e30e67b407c62b5561da20bf9232b15e Mon Sep 17 00:00:00 2001 From: Panos Mavrogiorgos Date: Thu, 22 Aug 2024 12:47:45 +0300 Subject: [PATCH] test: xfail jigsaw + buffering Reference: https://github.com/ec-jrc/pyPoseidon/issues/196 --- tests/test_mesh.py | 6 +++--- tests/test_mesh_global.py | 44 +++++++++++++++++++-------------------- 2 files changed, 24 insertions(+), 26 deletions(-) diff --git a/tests/test_mesh.py b/tests/test_mesh.py index e97d8ac..1c6db23 100644 --- a/tests/test_mesh.py +++ b/tests/test_mesh.py @@ -19,14 +19,14 @@ @WINDOWS -@pytest.mark.parametrize("ggor", ["jigsaw", "gmsh"]) -def test_answer(tmpdir, window, ggor): +@pytest.mark.parametrize("mesh_generator", ["jigsaw", "gmsh"]) +def test_answer(tmpdir, window, mesh_generator): mesh = pmesh.set( type="tri2d", geometry=window, coastlines=COAST_FILE, rpath=str(tmpdir) + "/", - mesh_generator=ggor, + mesh_generator=mesh_generator, ) check = np.isnan(mesh.Dataset.depth.values).sum() == 0 diff --git a/tests/test_mesh_global.py b/tests/test_mesh_global.py index eff2b29..0c8023b 100644 --- a/tests/test_mesh_global.py +++ b/tests/test_mesh_global.py @@ -1,10 +1,9 @@ -import os +import sys -import geopandas as gp import numpy as np -import pyposeidon.mesh as pmesh import pytest +import pyposeidon.mesh as pmesh from . import DATA_DIR DEM_FILE = (DATA_DIR / "dem.nc").as_posix() @@ -12,24 +11,26 @@ COAST_FILE = (DATA_DIR / "ocean.parquet").as_posix() -@pytest.mark.parametrize("ggor", ["jigsaw", "gmsh"]) -@pytest.mark.parametrize("bgmesh", [None, DEM_FILE]) -@pytest.mark.parametrize("bindings", [True, False]) +@pytest.mark.parametrize("mesh_generator,use_bindings", [("jigsaw", None), ("gmsh", True), ("gmsh", False)]) +@pytest.mark.parametrize("dem_source", [None, DEM_FILE]) @pytest.mark.parametrize("cbuffer", [None, 0.01]) -def test_io(pytestconfig, tmpdir, ggor, bgmesh, bindings, cbuffer): +def test_io(pytestconfig, tmpdir, mesh_generator, use_bindings, dem_source, cbuffer): # Skip the test unless --runslow has been passed - if bgmesh is not None: + if dem_source is not None: if not pytestconfig.getoption("--runslow"): pytest.skip("slow test") + if mesh_generator == "jigsaw" and cbuffer is not None and sys.platform != "darwin": + pytest.xfail("jigsaw + buffer is failing on linux: https://github.com/ec-jrc/pyPoseidon/issues/196") + mesh = pmesh.set( type="tri2d", geometry="global", coastlines=COAST_FILE, rpath=str(tmpdir) + "/", - mesh_generator=ggor, - dem_source=bgmesh, - use_bindings=bindings, + mesh_generator=mesh_generator, + dem_source=dem_source, + use_bindings=use_bindings, cbuffer=cbuffer, ) @@ -58,28 +59,25 @@ def test_io(pytestconfig, tmpdir, ggor, bgmesh, bindings, cbuffer): @pytest.mark.schism -@pytest.mark.parametrize("ggor", ["jigsaw", "gmsh"]) -@pytest.mark.parametrize("bgmesh", [None, DEM_FILE]) -@pytest.mark.parametrize("bindings", [True, False]) +@pytest.mark.parametrize("mesh_generator,use_bindings", [("jigsaw", None), ("gmsh", True), ("gmsh", False)]) +@pytest.mark.parametrize("dem_source", [None, DEM_FILE]) @pytest.mark.parametrize("cbuffer", [None, 0.01]) -def test_validate(pytestconfig, tmpdir, ggor, cbuffer, bgmesh, bindings): - if bgmesh is not None: +def test_validate(pytestconfig, tmpdir, mesh_generator, use_bindings, dem_source, cbuffer): + if dem_source is not None: if not pytestconfig.getoption("--runslow"): pytest.skip("slow test") - if ggor == "jigsaw": - pytest.xfail("Fixing these is a WIP") - # if ggor == "jigsaw": - # pytest.xfail("Fixing these is a WIP") + if mesh_generator == "jigsaw" and cbuffer is not None and sys.platform != "darwin": + pytest.xfail("jigsaw + buffer is failing on linux: https://github.com/ec-jrc/pyPoseidon/issues/196") mesh = pmesh.set( type="tri2d", geometry="global", coastlines=COAST_FILE, rpath=str(tmpdir) + "/", - mesh_generator=ggor, - dem_source=bgmesh, - use_bindings=bindings, + mesh_generator=mesh_generator, + dem_source=dem_source, + use_bindings=use_bindings, cbuffer=cbuffer, )