Skip to content

Commit ca7f68e

Browse files
committed
Use pytest-forked to isolate MPI state
Add `--forked` flag to `run_integrated_tests.sh` to isolate C++/MPI state between tests, preventing OpenMPI 5 double-initialization crashes.
1 parent a45a547 commit ca7f68e

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ boutdata>=0.3.0
88
zoidberg>=0.2.2
99
pytest
1010
pytest-xdist
11+
pytest-forked

tests/run_integrated_tests.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ export PYTHONPATH="@PROJECT_BINARY_DIR@/tools/pylib:@PROJECT_SOURCE_DIR@/tools/p
77
# Pre-build the project to prevent concurrent CMake race conditions
88
cmake --build "$PROJECT_ROOT"
99

10-
# Use the Python executable that CMake discovered during configuration
11-
"@Python3_EXECUTABLE@" -m pytest -m "not serial" --cache-clear -n auto --dist=loadgroup -q "$PROJECT_ROOT/tests/integrated" "$@"
12-
"@Python3_EXECUTABLE@" -m pytest -m serial "$PROJECT_ROOT/tests/integrated" "$@"
10+
# Use --forked to isolate C++/MPI state for every single test
11+
"@Python3_EXECUTABLE@" -m pytest --forked -m "not serial" --cache-clear -n auto --dist=loadgroup -q "$PROJECT_ROOT/tests/integrated" "$@"
12+
"@Python3_EXECUTABLE@" -m pytest --forked -m serial "$PROJECT_ROOT/tests/integrated" "$@"

0 commit comments

Comments
 (0)