From 0a1a14d13e7de8ef651575a8c7eb2099639e2ec7 Mon Sep 17 00:00:00 2001 From: DavHau Date: Sat, 15 May 2021 15:14:01 +0700 Subject: [PATCH] python3Packages.scikit-learn: enable parallel building and testing --- .../python-modules/scikit-learn/default.nix | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/pkgs/development/python-modules/scikit-learn/default.nix b/pkgs/development/python-modules/scikit-learn/default.nix index 7e9e37831e0d..dfce61df6c6e 100644 --- a/pkgs/development/python-modules/scikit-learn/default.nix +++ b/pkgs/development/python-modules/scikit-learn/default.nix @@ -7,7 +7,8 @@ , glibcLocales , numpy , scipy -, pytest +, pytestCheckHook +, pytest-xdist , pillow , cython , joblib @@ -54,17 +55,30 @@ buildPythonPackage rec { joblib threadpoolctl ]; - checkInputs = [ pytest ]; + + checkInputs = [ pytestCheckHook pytest-xdist ]; LC_ALL="en_US.UTF-8"; - doCheck = !stdenv.isAarch64; - # Skip test_feature_importance_regression - does web fetch - checkPhase = '' - cd $TMPDIR - HOME=$TMPDIR OMP_NUM_THREADS=1 pytest -k "not test_feature_importance_regression" --pyargs sklearn + preBuild = '' + export SKLEARN_BUILD_PARALLEL=$NIX_BUILD_CORES ''; + doCheck = !stdenv.isAarch64; + + # Skip test_feature_importance_regression - does web fetch + disabledTests = [ "test_feature_importance_regression" ]; + + pytestFlagsArray = [ "-n" "$NIX_BUILD_CORES" "--pyargs" "sklearn" ]; + + preCheck = '' + cd $TMPDIR + export HOME=$TMPDIR + export OMP_NUM_THREADS=1 + ''; + + pythonImportsCheck = [ "sklearn" ]; + meta = with lib; { description = "A set of python modules for machine learning and data mining"; changelog = let