From 73290ca91b1bae1485ce469525596e75e88186c8 Mon Sep 17 00:00:00 2001
From: Alban Grastien <alban.grastien@cea.fr>
Date: Thu, 1 Aug 2024 10:57:31 +0200
Subject: [PATCH] [ci][test][wip] relax constraints on location of python3
 interpreter

---
 .gitlab-ci.yml          |  6 ------
 Makefile                |  2 +-
 flake.nix               | 15 +++++++++++++--
 lib/ovo/tests/linear.ml |  4 ++--
 4 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 637c198..a6f3b57 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -70,12 +70,6 @@ test:
     - nix --extra-experimental-features "nix-command flakes" build
     - nix --extra-experimental-features "nix-command flakes" flake check -L
 
-test-lib:
-  stage: test
-  script:
-    - nix --extra-experimental-features "nix-command flakes" build
-    - nix --extra-experimental-features "nix-command flakes" develop --command make test-lib
-
 ## Manual generation of the documentation
 
 documentation:
diff --git a/Makefile b/Makefile
index 5efdb4f..6b365c0 100644
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@ test-ci:
 	dune build -j2 @tests/ci
 
 test-lib:
-	dune runtest lib
+	dune runtest -j2 lib
 
 promote:
 	dune promote --root=.
diff --git a/flake.nix b/flake.nix
index c2ad91a..a3f4e64 100644
--- a/flake.nix
+++ b/flake.nix
@@ -99,11 +99,22 @@
               dontInstall = true;
               doCheck = true;
               checkPhase = ''
-                make test
                 make test-ci
+                make test-lib
               '';
               buildInputs = oldAttrs.buildInputs ++
-                [ pkgs.python3Packages.onnx pkgs.python3Packages.scikit-learn ];
+                [
+                  pkgs.python3
+                  pkgs.python3Packages.onnx
+                  pkgs.python3Packages.scikit-learn
+                ];
+              nativeBuildInputs = oldAttrs.nativeBuildInputs ++
+                [
+                  pkgs.python3
+                  pkgs.python3Packages.onnx
+                  pkgs.python3Packages.scikit-learn
+                ];
+
             });
       };
       apps = rec {
diff --git a/lib/ovo/tests/linear.ml b/lib/ovo/tests/linear.ml
index 8c3bab6..3c58eee 100644
--- a/lib/ovo/tests/linear.ml
+++ b/lib/ovo/tests/linear.ml
@@ -39,7 +39,7 @@ let test_filename = dir ^ "/tests"
 (* 1 *)
 let () =
   let pid =
-    Unix.create_process "/usr/bin/python3"
+    Unix.create_process "python3"
       [|
         "python3";
         "../../../tests/bin/gen_linear_ovo.py";
@@ -61,7 +61,7 @@ let () =
 (* 3 *)
 let () =
   let pid =
-    Unix.create_process "/usr/bin/python3"
+    Unix.create_process "python3"
       [|
         "python3";
         "../../../tests/bin/check_onnx.py";
-- 
GitLab