faiss: mv test.pytest to python3Packages.test, fix eval

This commit is contained in:
SomeoneSerge 2024-07-28 16:50:30 +00:00 committed by Someone Serge
parent b9fb14ccf6
commit 670ac5606c
3 changed files with 26 additions and 12 deletions

View File

@ -137,7 +137,9 @@ stdenv.mkDerivation {
'' ''
demo_ivfpq_indexing && touch $out demo_ivfpq_indexing && touch $out
''; '';
} // lib.optionalAttrs pythonSupport { pytest = pythonPackages.callPackage ./tests.nix { }; }; pythonFaiss = pythonPackages.faiss;
pytest = pythonPackages.faiss.tests.pytest;
};
}; };
meta = with lib; { meta = with lib; {

View File

@ -1,6 +1,7 @@
{ {
lib, lib,
buildPythonPackage, buildPythonPackage,
callPackage,
faiss-build, faiss-build,
numpy, numpy,
packaging, packaging,
@ -39,6 +40,14 @@ buildPythonPackage {
pythonImportsCheck = [ "faiss" ]; pythonImportsCheck = [ "faiss" ];
passthru = {
inherit (faiss-build) cudaSupport cudaPackages pythonSupport;
tests = {
pytest = callPackage ./pytest.nix { inherit faiss-build; };
};
};
meta = lib.pipe (faiss-build.meta or { }) [ meta = lib.pipe (faiss-build.meta or { }) [
(lib.flip builtins.removeAttrs [ "mainProgram" ]) (lib.flip builtins.removeAttrs [ "mainProgram" ])
(m: m // { description = "Bindings for faiss, the similarity search library"; }) (m: m // { description = "Bindings for faiss, the similarity search library"; })

View File

@ -1,8 +1,10 @@
{ lib {
, buildPythonPackage lib,
, faiss buildPythonPackage,
, scipy faiss,
, pytestCheckHook faiss-build,
scipy,
pytestCheckHook,
}: }:
assert faiss.pythonSupport; assert faiss.pythonSupport;
@ -13,15 +15,13 @@ buildPythonPackage {
format = "other"; format = "other";
src = "${faiss.src}/tests"; src = "${faiss-build.src}/tests";
dontBuild = true; dontBuild = true;
dontInstall = true; dontInstall = true;
# Tests that need GPUs and would fail in the sandbox # Tests that need GPUs and would fail in the sandbox
disabledTestPaths = lib.optionals faiss.cudaSupport [ disabledTestPaths = lib.optionals faiss.cudaSupport [ "test_contrib.py" ];
"test_contrib.py"
];
disabledTests = [ disabledTests = [
# https://github.com/facebookresearch/faiss/issues/2836 # https://github.com/facebookresearch/faiss/issues/2836
@ -32,6 +32,9 @@ buildPythonPackage {
faiss faiss
pytestCheckHook pytestCheckHook
scipy scipy
] ++ ];
faiss.extra-requires.all;
meta = faiss.meta // {
description = "Faiss test suite";
};
} }