From c47cf8cca0dde145b9e5e45050b2667107eef03e Mon Sep 17 00:00:00 2001 From: qbisi Date: Sun, 16 Mar 2025 03:27:26 +0800 Subject: [PATCH] petsc: fix and add python related tests --- pkgs/by-name/pe/petsc/package.nix | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/pe/petsc/package.nix b/pkgs/by-name/pe/petsc/package.nix index 8e0abca000e2..9e169fa48436 100644 --- a/pkgs/by-name/pe/petsc/package.nix +++ b/pkgs/by-name/pe/petsc/package.nix @@ -174,7 +174,28 @@ stdenv.mkDerivation rec { # the library is installed and available. doInstallCheck = true; installCheckTarget = "check_install"; - nativeInstallCheckInputs = [ mpiCheckPhaseHook ]; + + # The PETSC4PY=no flag disables the ex100 test, + # which compiles C code to load Python modules for solving a math problem. + # This test fails on the Darwin platform but is rarely a common use case for petsc4py. + installCheckFlags = lib.optional stdenv.hostPlatform.isDarwin "PETSC4PY=no"; + + nativeInstallCheckInputs = + [ + mpiCheckPhaseHook + ] + ++ lib.optionals pythonSupport [ + python3Packages.pythonImportsCheckHook + python3Packages.unittestCheckHook + ]; + + unittestFlagsArray = [ + "-s" + "src/binding/petsc4py/test" + "-v" + ]; + + pythonImportsCheck = [ "petsc4py" ]; passthru = { inherit mpiSupport pythonSupport;