python3Packages.orange3: fix test

Signed-off-by: lucasew <lucas59356@gmail.com>
This commit is contained in:
lucasew 2024-05-14 15:44:00 -03:00
parent c29c7f5f91
commit b51053ad88

View File

@ -1,4 +1,5 @@
{ lib
, stdenv
, baycomp
, bottleneck
, buildPythonPackage
@ -24,12 +25,15 @@
, orange-canvas-core
, orange-widget-base
, pandas
, pytestCheckHook
, pytest-qt
, pyqtgraph
, pyqtwebengine
, python
, python-louvain
, pythonOlder
, pyyaml
, pip
, qt5
, qtconsole
, recommonmark
@ -112,6 +116,7 @@ let
keyrings-alt
pyyaml
baycomp
pip
];
# FIXME: ImportError: cannot import name '_variable' from partially initialized module 'Orange.data' (most likely due to a circular import) (/build/source/Orange/data/__init__.py)
@ -146,9 +151,9 @@ let
passthru = {
updateScript = nix-update-script { };
tests.unittests = self.overridePythonAttrs (old: {
pname = "${old.pname}-tests";
format = "other";
tests.unittests = stdenv.mkDerivation {
name = "${self.name}-tests";
inherit (self) src;
preCheck = ''
export HOME=$(mktemp -d)
@ -160,23 +165,32 @@ let
cp -r ${self}/${python.sitePackages}/Orange .
chmod +w -R .
rm Orange/tests/test_url_reader.py # uses network
rm Orange/tests/test_ada_boost.py # broken: The 'base_estimator' parameter of AdaBoostRegressor must be an object implementing 'fit' and 'predict' or a str among {'deprecated'}. Got None instead.
substituteInPlace Orange/classification/tests/test_xgb_cls.py \
--replace test_learners mk_test_learners
substituteInPlace Orange/modelling/tests/test_xgb.py \
--replace test_learners mk_test_learners
substituteInPlace Orange/**/tests/*.py \
--replace test_filename filename_test
# TODO: debug why orange is crashing on GC, may be a upstream issue
chmod +x Orange/__init__.py
echo "import gc; gc.disable()" | tee -a Orange/__init__.py
'';
checkPhase = ''
runHook preCheck
${python.interpreter} -m unittest -b -v ./Orange/**/test*.py
runHook postCheck
'';
nativeBuildInputs = [ pytestCheckHook pytest-qt ];
postInstall = "";
postCheck = ''
touch $out
'';
doBuild = false;
doInstall = false;
nativeBuildInputs = [ self ] ++ old.nativeBuildInputs;
});
buildInputs = [ self ];
};
};
meta = with lib; {