diff --git a/pkgs/development/python-modules/mpi4py/default.nix b/pkgs/development/python-modules/mpi4py/default.nix index 42422d61a0d7..93162a1bff7f 100644 --- a/pkgs/development/python-modules/mpi4py/default.nix +++ b/pkgs/development/python-modules/mpi4py/default.nix @@ -6,8 +6,10 @@ setuptools, mpi, toPythonModule, - pytestCheckHook, + pytest, mpiCheckPhaseHook, + mpi4py, + mpich, }: buildPythonPackage rec { @@ -40,17 +42,9 @@ buildPythonPackage rec { pythonImportsCheck = [ "mpi4py" ]; nativeCheckInputs = [ - pytestCheckHook + pytest mpiCheckPhaseHook ]; - disabledTestPaths = lib.optionals (mpi.pname == "mpich") [ - # These tests from some reason cause pytest to crash, and therefor it is - # hard to debug them. Upstream mentions these tests to raise issues in - # https://github.com/mpi4py/mpi4py/issues/418 but the workaround suggested - # there (setting MPI4PY_RC_RECV_MPROBE=0) doesn't work. - "test/test_util_pool.py" - "demo/futures/test_futures.py" - ]; __darwinAllowLocalNetworking = true; @@ -58,8 +52,25 @@ buildPythonPackage rec { # see https://github.com/mpi4py/mpi4py/issues/545#issuecomment-2343011460 env.MPI4PY_TEST_SPAWN = if mpi.pname == "openmpi" then 0 else 1; + # follow upstream's checkPhase + # see https://github.com/mpi4py/mpi4py/blob/4.1.0/.github/workflows/ci-test.yml#L92-L95 + checkPhase = '' + runHook preCheck + + echo 'Testing mpi4py (np=1)' + mpiexec -n 1 python test/main.py -v + echo 'Testing mpi4py (np=2)' + mpiexec -n 2 python test/main.py -v -f -e spawn + + runHook postCheck + ''; + passthru = { inherit mpi; + + tests = { + mpich = mpi4py.override { mpi = mpich; }; + }; }; meta = {