From ee85c13df19438a55fc1be1f93b7bce7a309ca8b Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Tue, 6 Sep 2022 19:38:23 +0200 Subject: [PATCH] python310Packages.bayesian-optimization: Fix broken tests (#181205) * python310Packages.bayesian-optimization: Fix tests * python310Packages.bayesian-optimization: add pythonImportsCheck Co-authored-by: superherointj <5861043+superherointj@users.noreply.github.com> --- .../bayesian-optimization/default.nix | 31 ++++++++++++++----- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/pkgs/development/python-modules/bayesian-optimization/default.nix b/pkgs/development/python-modules/bayesian-optimization/default.nix index ec27aa5e37ae..03ac94ad6044 100644 --- a/pkgs/development/python-modules/bayesian-optimization/default.nix +++ b/pkgs/development/python-modules/bayesian-optimization/default.nix @@ -4,8 +4,9 @@ , fetchFromGitHub , scikit-learn , scipy -, pytest +, pytestCheckHook , isPy27 +, fetchpatch }: buildPythonPackage rec { @@ -25,15 +26,31 @@ buildPythonPackage rec { scipy ]; - checkInputs = [ pytest ]; - checkPhase = '' - # New sklearn broke one test: https://github.com/fmfn/BayesianOptimization/issues/243 - pytest tests -k "not test_suggest_with_one_observation" - ''; + patches = [ + # TypeError with scipy >= 1.8 + # https://github.com/fmfn/BayesianOptimization/issues/300 + (fetchpatch { + url = "https://github.com/fmfn/BayesianOptimization/commit/b4e09a25842985a4a0acea0c0f5c8789b7be125e.patch"; + sha256 = "sha256-PfcifCFd4GRNTA+4+T+6A760QAgyZxhDCTyzNn2crdM="; + name = "scipy_18_fix.patch"; + }) + ]; + + checkInputs = [ pytestCheckHook ]; + + disabledTests = [ + # New sklearn broke one test + # https://github.com/fmfn/BayesianOptimization/issues/243 + "test_suggest_with_one_observation" + ]; + + pythonImportsCheck = [ "bayes_opt" ]; meta = with lib; { broken = (stdenv.isLinux && stdenv.isAarch64) || stdenv.isDarwin; - description = "A Python implementation of global optimization with gaussian processes"; + description = '' + A Python implementation of global optimization with gaussian processes + ''; homepage = "https://github.com/fmfn/BayesianOptimization"; license = licenses.mit; maintainers = [ maintainers.juliendehos ];