From 6c678866d1c628de4d09bfa78acc76758279b2b0 Mon Sep 17 00:00:00 2001
From: schnellerhase <56360279+schnellerhase@users.noreply.github.com>
Date: Mon, 24 Nov 2025 15:22:09 +0100
Subject: [PATCH 1/6] Parametrize test over partitioners

---
 python/test/unit/mesh/test_mesh.py | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/python/test/unit/mesh/test_mesh.py b/python/test/unit/mesh/test_mesh.py
index 2fcad72e94..f8f9d6261b 100644
--- a/python/test/unit/mesh/test_mesh.py
+++ b/python/test/unit/mesh/test_mesh.py
@@ -13,6 +13,7 @@
 import pytest
 
 import basix
+import dolfinx.cpp.graph
 import ufl
 from basix.ufl import element
 from dolfinx import cpp as _cpp
@@ -736,7 +737,17 @@ def test_mesh_create_cmap(dtype):
     assert msh.ufl_domain() is None
 
 
-def test_mesh_single_process_distribution():
+avail_partioners = []
+if dolfinx.has_ptscotch:
+    avail_partioners.append(dolfinx.cpp.graph.partitioner_scotch)
+if dolfinx.has_kahip:
+    avail_partioners.append(dolfinx.cpp.graph.partitioner_kahip)
+if dolfinx.has_parmetis:
+    avail_partioners.append(dolfinx.cpp.graph.partitioner_parmetis)
+
+
+@pytest.mark.parametrize("partitioner", avail_partioners)
+def test_mesh_single_process_distribution(partitioner):
     comm = MPI.COMM_WORLD
 
     if comm.rank == 0:
@@ -750,7 +761,13 @@ def test_mesh_single_process_distribution():
         x = np.zeros((0, 3), dtype=np.float64)
 
     element = ufl.Mesh(basix.ufl.element("Lagrange", "interval", 1, shape=(3,)))
-    mesh = _mesh.create_mesh(MPI.COMM_WORLD, cells, element, x)
+    mesh = _mesh.create_mesh(
+        MPI.COMM_WORLD,
+        cells,
+        element,
+        x,
+        partitioner=dolfinx.mesh.create_cell_partitioner(partitioner()),
+    )
 
     assert mesh.topology.index_map(0).size_global == 3
     assert mesh.topology.index_map(1).size_global == 3

From 2eeffee3955dad822924f18ed0e6a63820b834c2 Mon Sep 17 00:00:00 2001
From: schnellerhase <56360279+schnellerhase@users.noreply.github.com>
Date: Mon, 24 Nov 2025 16:20:25 +0100
Subject: [PATCH 2/6] xfail broken test

---
 python/test/unit/mesh/test_mesh.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/python/test/unit/mesh/test_mesh.py b/python/test/unit/mesh/test_mesh.py
index f8f9d6261b..b5af9cad3f 100644
--- a/python/test/unit/mesh/test_mesh.py
+++ b/python/test/unit/mesh/test_mesh.py
@@ -739,7 +739,9 @@ def test_mesh_create_cmap(dtype):
 
 avail_partioners = []
 if dolfinx.has_ptscotch:
-    avail_partioners.append(dolfinx.cpp.graph.partitioner_scotch)
+    avail_partioners.append(
+        pytest.param(dolfinx.cpp.graph.partitioner_scotch, marks=pytest.mark.xfail(reason="Bug"))
+    )
 if dolfinx.has_kahip:
     avail_partioners.append(dolfinx.cpp.graph.partitioner_kahip)
 if dolfinx.has_parmetis:
@@ -775,5 +777,6 @@ def test_mesh_single_process_distribution(partitioner):
     for conn in ((0, 1), (1, 0)):
         mesh.topology.create_connectivity(*conn)
         adj = mesh.topology.connectivity(*conn)
+        print(adj.array)
         for i in range(adj.num_nodes):
             assert adj.links(i).size == 2

From c750f4a1717afc8bb06b077ff781b20681b01442 Mon Sep 17 00:00:00 2001
From: schnellerhase <56360279+schnellerhase@users.noreply.github.com>
Date: Mon, 24 Nov 2025 17:10:38 +0100
Subject: [PATCH 3/6] Context to skip

---
 python/test/unit/mesh/test_mesh.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/python/test/unit/mesh/test_mesh.py b/python/test/unit/mesh/test_mesh.py
index b5af9cad3f..56df1b2fe7 100644
--- a/python/test/unit/mesh/test_mesh.py
+++ b/python/test/unit/mesh/test_mesh.py
@@ -740,7 +740,12 @@ def test_mesh_create_cmap(dtype):
 avail_partioners = []
 if dolfinx.has_ptscotch:
     avail_partioners.append(
-        pytest.param(dolfinx.cpp.graph.partitioner_scotch, marks=pytest.mark.xfail(reason="Bug"))
+        pytest.param(
+            dolfinx.cpp.graph.partitioner_scotch,
+            marks=pytest.mark.xfail(
+                reason="SCOTCH partitioner results in parallel in unpexpected mesh connectivity."
+            ),
+        )
     )
 if dolfinx.has_kahip:
     avail_partioners.append(dolfinx.cpp.graph.partitioner_kahip)

From f81cf30ed6fe9f1c8c7cbb86ba4eb8df607d0de5 Mon Sep 17 00:00:00 2001
From: Drew Parsons <dparsons@debian.org>
Date: Mon, 24 Nov 2025 17:35:42 +0100
Subject: [PATCH 4/6] minor spelling correction

---
 python/test/unit/mesh/test_mesh.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/python/test/unit/mesh/test_mesh.py b/python/test/unit/mesh/test_mesh.py
index 56df1b2fe7..b79fd24305 100644
--- a/python/test/unit/mesh/test_mesh.py
+++ b/python/test/unit/mesh/test_mesh.py
@@ -650,10 +650,10 @@ def test_boundary_facets(n, d, ghost_mode, dtype):
     """Test that the correct number of boundary facets are computed"""
     if d == 2:
         mesh = create_unit_square(MPI.COMM_WORLD, n, n, ghost_mode=ghost_mode, dtype=dtype)
-        expected_num_boundary_facets = 4 * n
+        exd_num_boundary_facets = 4 * n
     else:
         mesh = create_unit_cube(MPI.COMM_WORLD, n, n, n, ghost_mode=ghost_mode, dtype=dtype)
-        expected_num_boundary_facets = 6 * n**2 * 2
+        exd_num_boundary_facets = 6 * n**2 * 2
 
     assert compute_num_boundary_facets(mesh) == expected_num_boundary_facets
 
@@ -743,7 +743,7 @@ def test_mesh_create_cmap(dtype):
         pytest.param(
             dolfinx.cpp.graph.partitioner_scotch,
             marks=pytest.mark.xfail(
-                reason="SCOTCH partitioner results in parallel in unpexpected mesh connectivity."
+                reason="SCOTCH partitioner in parallel results in unexpected mesh connectivity."
             ),
         )
     )

From 25d7ec7b408ed75528fa7c471631b8184d9f8c5e Mon Sep 17 00:00:00 2001
From: schnellerhase <56360279+schnellerhase@users.noreply.github.com>
Date: Mon, 24 Nov 2025 18:38:30 +0100
Subject: [PATCH 5/6] fix

---
 python/test/unit/mesh/test_mesh.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/python/test/unit/mesh/test_mesh.py b/python/test/unit/mesh/test_mesh.py
index b79fd24305..c27515d81a 100644
--- a/python/test/unit/mesh/test_mesh.py
+++ b/python/test/unit/mesh/test_mesh.py
@@ -655,7 +655,7 @@ def test_boundary_facets(n, d, ghost_mode, dtype):
         mesh = create_unit_cube(MPI.COMM_WORLD, n, n, n, ghost_mode=ghost_mode, dtype=dtype)
         exd_num_boundary_facets = 6 * n**2 * 2
 
-    assert compute_num_boundary_facets(mesh) == expected_num_boundary_facets
+    assert compute_num_boundary_facets(mesh) == exd_num_boundary_facets
 
 
 @pytest.mark.parametrize("n", [3, 5])

From f99c6f1719664ab58eb2e94679a826934c8e1732 Mon Sep 17 00:00:00 2001
From: schnellerhase <56360279+schnellerhase@users.noreply.github.com>
Date: Mon, 24 Nov 2025 18:39:50 +0100
Subject: [PATCH 6/6] Remove debug output

---
 python/test/unit/mesh/test_mesh.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/python/test/unit/mesh/test_mesh.py b/python/test/unit/mesh/test_mesh.py
index c27515d81a..d93da73cb1 100644
--- a/python/test/unit/mesh/test_mesh.py
+++ b/python/test/unit/mesh/test_mesh.py
@@ -782,6 +782,5 @@ def test_mesh_single_process_distribution(partitioner):
     for conn in ((0, 1), (1, 0)):
         mesh.topology.create_connectivity(*conn)
         adj = mesh.topology.connectivity(*conn)
-        print(adj.array)
         for i in range(adj.num_nodes):
             assert adj.links(i).size == 2
