From 6a3317579da615bc7bbd8b33ce6db3fd1197499e Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Thu, 13 Feb 2025 01:19:24 +0100 Subject: [PATCH 1/2] python312Packages.kserve: fix on darwin and linux --- .../python-modules/kserve/default.nix | 40 +++++++++++++++---- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/pkgs/development/python-modules/kserve/default.nix b/pkgs/development/python-modules/kserve/default.nix index 2fc4813f1a7a..20ed84acdf57 100644 --- a/pkgs/development/python-modules/kserve/default.nix +++ b/pkgs/development/python-modules/kserve/default.nix @@ -1,5 +1,6 @@ { lib, + stdenv, buildPythonPackage, fetchFromGitHub, @@ -121,19 +122,44 @@ buildPythonPackage rec { pythonImportsCheck = [ "kserve" ]; + pytestFlagsArray = + [ + # AssertionError + "--deselect=test/test_server.py::TestTFHttpServerLoadAndUnLoad::test_unload" + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + # RuntimeError: Failed to start GCS + "--deselect=test/test_dataplane.py::TestDataPlane::test_explain" + "--deselect=test/test_dataplane.py::TestDataPlane::test_infer" + "--deselect=test/test_dataplane.py::TestDataPlane::test_model_metadata" + "--deselect=test/test_dataplane.py::TestDataPlane::test_server_readiness" + "--deselect=test/test_server.py::TestRayServer::test_explain" + "--deselect=test/test_server.py::TestRayServer::test_health_handler" + "--deselect=test/test_server.py::TestRayServer::test_infer" + "--deselect=test/test_server.py::TestRayServer::test_list_handler" + "--deselect=test/test_server.py::TestRayServer::test_liveness_handler" + "--deselect=test/test_server.py::TestRayServer::test_predict" + ]; + disabledTestPaths = [ # Looks for a config file at the root of the repository "test/test_inference_service_client.py" ]; - disabledTests = [ - # Require network access - "test_infer_graph_endpoint" - "test_infer_path_based_routing" + disabledTests = + [ + # Require network access + "test_infer_graph_endpoint" + "test_infer_path_based_routing" - # Tries to access `/tmp` (hardcoded) - "test_local_path_with_out_dir_exist" - ]; + # Tries to access `/tmp` (hardcoded) + "test_local_path_with_out_dir_exist" + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + "test_local_path_with_out_dir_not_exist" + ]; + + __darwinAllowLocalNetworking = true; meta = { description = "Standardized Serverless ML Inference Platform on Kubernetes"; From ae077d04777ff7c781023ec027d279a2a11edc81 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Thu, 13 Feb 2025 01:45:21 +0100 Subject: [PATCH 2/2] python312Packages.kserve: use pytest-xdist to speedup testing --- pkgs/development/python-modules/kserve/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/development/python-modules/kserve/default.nix b/pkgs/development/python-modules/kserve/default.nix index 20ed84acdf57..8ba8618faa8e 100644 --- a/pkgs/development/python-modules/kserve/default.nix +++ b/pkgs/development/python-modules/kserve/default.nix @@ -44,6 +44,7 @@ avro, grpcio-testing, pytest-asyncio, + pytest-xdist, pytestCheckHook, tomlkit, }: @@ -116,6 +117,7 @@ buildPythonPackage rec { avro grpcio-testing pytest-asyncio + pytest-xdist pytestCheckHook tomlkit ] ++ lib.flatten (builtins.attrValues optional-dependencies);