From c9c85aad46eeff6bfc280fefe7248ee2033efcd6 Mon Sep 17 00:00:00 2001 From: ampdes Date: Fri, 16 Aug 2024 08:21:08 +0200 Subject: [PATCH] Fix import errors --- python/test/unit/io/test_adios2.py | 4 +++- python/test/unit/io/test_xdmf_meshtags.py | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/python/test/unit/io/test_adios2.py b/python/test/unit/io/test_adios2.py index f82b3107957..1fa29ef2de7 100644 --- a/python/test/unit/io/test_adios2.py +++ b/python/test/unit/io/test_adios2.py @@ -16,7 +16,6 @@ from dolfinx import default_real_type, default_scalar_type from dolfinx.fem import Function, assemble_scalar, form, functionspace from dolfinx.graph import adjacencylist -from dolfinx.io import ADIOS2, read_mesh, write_mesh from dolfinx.mesh import CellType, GhostMode, create_mesh, create_unit_cube, create_unit_square @@ -47,6 +46,9 @@ def generate_mesh(dim: int, simplex: bool, N: int = 5, dtype=None): @pytest.mark.parametrize("dim", [2, 3]) @pytest.mark.parametrize("simplex", [True, False]) def test_mesh_read_write(encoder, suffix, ghost_mode, dtype, dim, simplex, tmp_path): + "Test writing of a mesh" + from dolfinx.io import ADIOS2, read_mesh, write_mesh + N = 5 # Consistent tmp dir across processes fname = MPI.COMM_WORLD.bcast(tmp_path, root=0) diff --git a/python/test/unit/io/test_xdmf_meshtags.py b/python/test/unit/io/test_xdmf_meshtags.py index fd777a75b46..d8d18f48da5 100644 --- a/python/test/unit/io/test_xdmf_meshtags.py +++ b/python/test/unit/io/test_xdmf_meshtags.py @@ -5,7 +5,7 @@ # SPDX-License-Identifier: LGPL-3.0-or-later from pathlib import Path -from xml.etree import ElementTree +from xml.etree import ElementTree as ET from mpi4py import MPI @@ -93,8 +93,8 @@ def test_3d(tempdir, cell_type, encoding): facets_local = comm.allreduce( (mt.indices < mesh.topology.index_map(2).size_local).sum(), op=MPI.SUM ) - parser = ElementTree.XMLParser() - tree = ElementTree.parse(Path(tempdir, "meshtags_3d_out.xdmf"), parser) + parser = ET.XMLParser() + tree = ET.parse(Path(tempdir, "meshtags_3d_out.xdmf"), parser) num_lines = int(tree.findall(".//Grid[@Name='lines']/Topology")[0].get("NumberOfElements")) num_facets = int(tree.findall(".//Grid[@Name='facets']/Topology")[0].get("NumberOfElements")) assert num_lines == lines_local