From fd47df4abdae43c9aaea993542ddd783eb6846e6 Mon Sep 17 00:00:00 2001 From: "Jack S. Hale" Date: Tue, 10 Sep 2024 18:12:14 +0200 Subject: [PATCH] Skip test if adios2 python module built without MPI. (#3124) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * This test only works if ADIOS2 was built with MPI. * Require MPI ADIOS2 build during configuration. * Reformat ruff. * Require adios2.10 for given test * Ruff * Simplify * Add back skip --------- Co-authored-by: Garth N. Wells Co-authored-by: jorgensd Co-authored-by: Jørgen S. Dokken --- python/test/unit/io/test_adios2.py | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/python/test/unit/io/test_adios2.py b/python/test/unit/io/test_adios2.py index 980558415dd..cad2c2a697e 100644 --- a/python/test/unit/io/test_adios2.py +++ b/python/test/unit/io/test_adios2.py @@ -293,7 +293,9 @@ def test_vtx_reuse_mesh(self, tempdir, dim, simplex, reuse): """Test reusage of mesh by VTXWriter.""" from dolfinx.io import VTXMeshPolicy, VTXWriter - adios2 = pytest.importorskip("adios2") + adios2 = pytest.importorskip("adios2", minversion="2.10.0") + if not adios2.is_built_with_mpi: + pytest.skip("Require adios2 built with MPI support") mesh = generate_mesh(dim, simplex) v = Function(functionspace(mesh, ("Lagrange", 1))) @@ -312,19 +314,12 @@ def test_vtx_reuse_mesh(self, tempdir, dim, simplex, reuse): reuse_variables = ["NumberOfEntities", "NumberOfNodes", "connectivity", "geometry", "types"] target_all = 3 # For all other variables the step count is number of writes - target_mesh = ( - 1 if reuse else 3 - ) # For mesh variables the step count is 1 if reuse else number of writes - - # backwards compatibility adios2 < 2.10.0 - try: - adios_file = adios2.open(str(filename), "r", comm=mesh.comm, engine_type="BP4") - except AttributeError: - # adios2 >= v2.10.0 - adios = adios2.Adios(comm=mesh.comm) - io = adios.declare_io("TestData") - io.set_engine("BP4") - adios_file = adios2.Stream(io, str(filename), "r", mesh.comm) + target_mesh = 1 if reuse else 3 + # For mesh variables the step count is 1 if reuse else number of writes + adios = adios2.Adios(comm=mesh.comm) + io = adios.declare_io("TestData") + io.set_engine("BP4") + adios_file = adios2.Stream(io, str(filename), "r", mesh.comm) for name, var in adios_file.available_variables().items(): if name in reuse_variables: