python3Packages.pomegranate: fix for cnvkit tests.

This commit is contained in:
Alexis Praga
2025-08-06 11:36:23 +02:00
parent 0e22dd9743
commit f2abb2fbc8
@@ -3,20 +3,15 @@
stdenv,
buildPythonPackage,
fetchFromGitHub,
# build-system
fetchpatch,
pytestCheckHook,
setuptools,
# dependencies
apricot-select,
networkx,
numpy,
scikit-learn,
scipy,
torch,
# tests
pytestCheckHook,
}:
buildPythonPackage rec {
@@ -27,34 +22,10 @@ buildPythonPackage rec {
src = fetchFromGitHub {
repo = "pomegranate";
owner = "jmschrei";
# tag = "v${version}";
# No tag for 1.1.2
rev = "e9162731f4f109b7b17ecffde768734cacdb839b";
hash = "sha256-vVoAoZ+mph11ZfINT+yxRyk9rXv6FBDgxBz56P2K95Y=";
tag = "v${version}";
hash = "sha256-p2Gn0FXnsAHvRUeAqx4M1KH0+XvDl3fmUZZ7MiMvPSs=";
};
# _pickle.UnpicklingError: Weights only load failed.
# https://pytorch.org/docs/stable/generated/torch.load.html
postPatch = ''
substituteInPlace \
tests/distributions/test_bernoulli.py \
tests/distributions/test_categorical.py \
tests/distributions/test_exponential.py \
tests/distributions/test_gamma.py \
tests/distributions/test_independent_component.py \
tests/distributions/test_normal_diagonal.py \
tests/distributions/test_normal_full.py \
tests/distributions/test_poisson.py \
tests/distributions/test_student_t.py \
tests/distributions/test_uniform.py \
tests/test_bayes_classifier.py \
tests/test_gmm.py \
tests/test_kmeans.py \
--replace-fail \
'torch.load(".pytest.torch")' \
'torch.load(".pytest.torch", weights_only=False)'
'';
build-system = [ setuptools ];
dependencies = [
@@ -72,11 +43,20 @@ buildPythonPackage rec {
pytestCheckHook
];
disabledTestPaths = lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [
patches = [
# Fix tests for pytorch 2.6
(fetchpatch {
name = "python-2.6.patch";
url = "https://github.com/jmschrei/pomegranate/pull/1142/commits/9ff5d5e2c959b44e569937e777b26184d1752a7b.patch";
hash = "sha256-BXsVhkuL27QqK/n6Fa9oJCzrzNcL3EF6FblBeKXXSts=";
})
];
pytestFlagsArray = lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [
# AssertionError: Arrays are not almost equal to 6 decimals
"=tests/distributions/test_normal_full.py::test_fit"
"=tests/distributions/test_normal_full.py::test_from_summaries"
"=tests/distributions/test_normal_full.py::test_serialization"
"--deselect=tests/distributions/test_normal_full.py::test_fit"
"--deselect=tests/distributions/test_normal_full.py::test_from_summaries"
"--deselect=tests/distributions/test_normal_full.py::test_serialization"
];
disabledTests = [