Repository: spack/spack

Issue:
Testing issue: omega-h
Discovered a test failure in one of the test parts after converting to the new stand-alone test API (#44712 ).

### Steps to reproduce the failure(s) or link(s) to test output(s)

```console
$ spack -v test run omega-h
...
```


### Error message

<details><summary>Error message</summary>

<pre>
--------------------------------------------------------------------------
WARNING: Open MPI failed to open the /dev/knem device due to a local
error. Please check with your system administrator to get the problem
fixed, or set the smsc MCA variable to "^knem" to silence this warning
and run without knem support.

Open MPI will try to fall back on another single-copy mechanism if one
is available.  This may result in lower performance.

  Local host: borax5
  Errno:      2 (No such file or directory)
--------------------------------------------------------------------------
could not open file "box_100.osh/nparts"
</pre></details>


### Information on your system or the test runner

* **Spack:** 0.23.0.dev0 (bde8b6334fe9ed085eabe01996c9620dbb5d9f77)
* **Python:** 3.9.12
* **Platform:** linux-rhel8-broadwell
* **Concretizer:** clingo

### Additional information

```
PASSED: OmegaH::test_osh_scale
==> [2024-06-14-15:37:13.797414] Completed testing
==> [2024-06-14-15:37:13.797637]
======================= SUMMARY: omega-h-9.34.13-mtisup2 =======================
OmegaH::test_osh2vtk .. FAILED
OmegaH::test_osh_box .. PASSED
OmegaH::test_osh_scale .. PASSED
======================== 1 failed, 2 passed of 3 parts =========================
==> [2024-06-14-15:37:13.797694]
```

### General information

- [X] I have reported the version of Spack/Python/Platform/Runner
- [X] I have run `spack maintainers <name-of-the-package>` and **@mentioned** any maintainers
- [X] I have uploaded any available logs
- [X] I have searched the issues of this repo and believe this is not a duplicate


Discussion:
[test_osh2vtk.txt](https://github.com/user-attachments/files/15845058/test_osh2vtk.txt)

@tldahlgren @AcriusWinter Prior to #44712, the three tests were run in sequence where the output directories (`box.osh` and then `box_100.osh`) from each test were fed into the subsequent test.  Is it possible that after the changes the tests are not run in sequence or that they run within different working directories?
> @tldahlgren @AcriusWinter Prior to #44712, the three tests were run in sequence where the output directories (`box.osh` and then `box_100.osh`) from each test were fed into the subsequent test. Is it possible that after the changes the tests are not run in sequence or that they run within different working directories?

🤦 You're absolutely right!  I'd forgotten and neglected to review the changes in the superseded PR (https://github.com/spack/spack/pull/35807/files#diff-0dba4a81f747fde08ec671f254060e9cb409eb7e13639e81ad4ada3d7d984251).

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/omega-h/package.py b/var/spack/repos/builtin/packages/omega-h/package.py
--- a/var/spack/repos/builtin/packages/omega-h/package.py
+++ b/var/spack/repos/builtin/packages/omega-h/package.py
@@ -158,27 +158,20 @@ def flag_handler(self, name, flags):
 
         return (None, None, flags)
 
-    def test_osh_box(self):
-        """testing mesh construction"""
-        if self.spec.version < Version("9.34.1"):
+    def test_mesh(self):
+        """test construction, adaptation, and conversion of a mesh"""
+        if self.spec.satisfies("@:9.34.0"):
             raise SkipTest("Package must be installed as version 9.34.1 or later")
-        exe = which(join_path(self.prefix.bin, "osh_box"))
-        options = ["1", "1", "1", "2", "2", "2", "box.osh"]
-        exe(*options)
 
-    def test_osh_scale(self):
-        """testing mesh adaptation"""
-        if self.spec.version < Version("9.34.1"):
-            raise SkipTest("Package must be installed as version 9.34.1 or later")
-        exe = which(join_path(self.prefix.bin, "osh_scale"))
-        options = ["box.osh", "100", "box_100.osh"]
-        actual = exe(*options, output=str.split, error=str.split)
-        assert "adapting took" in actual
-
-    def test_osh2vtk(self):
-        """testing mesh to vtu conversion"""
-        if self.spec.version < Version("9.34.1"):
-            raise SkipTest("Package must be installed as version 9.34.1 or later")
-        exe = which(join_path(self.prefix.bin, "osh2vtk"))
-        options = ["box_100.osh", "box_100_vtk"]
-        exe(*options)
+        with test_part(self, "test_mesh_create", purpose="mesh construction"):
+            exe = which(self.prefix.bin.osh_box)
+            exe("1", "1", "1", "2", "2", "2", "box.osh")
+
+        with test_part(self, "test_mesh_adapt", purpose="mesh adaptation"):
+            exe = which(self.prefix.bin.osh_scale)
+            actual = exe("box.osh", "100", "box_100.osh", output=str.split, error=str.split)
+            assert "adapting took" in actual
+
+        with test_part(self, "test_mesh_convert", purpose="mesh to vtu conversion"):
+            exe = which(self.prefix.bin.osh2vtk)
+            exe("box_100.osh", "box_100_vtk")


Test patch: