about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--users/Profpatsch/writers/default.nix18
-rw-r--r--users/Profpatsch/writers/tests.nix19
2 files changed, 31 insertions, 6 deletions
diff --git a/users/Profpatsch/writers/default.nix b/users/Profpatsch/writers/default.nix
index f775913d0026..222172e38e09 100644
--- a/users/Profpatsch/writers/default.nix
+++ b/users/Profpatsch/writers/default.nix
@@ -2,6 +2,14 @@
 let
   bins = depot.nix.getBins pkgs.coreutils ["printf" "mkdir" "cat"];
 
+  python3 = name: args@{
+    libraries ? (_: []),
+    flakeIgnore ? []
+  }: pkgs.writers.writePython3 name {
+    libraries = libraries pkgs.python3Packages;
+    flakeIgnore = flakeIgnore;
+  };
+
   python3Lib = { name, libraries ? (_: []) }: moduleString:
     let srcTree = depot.nix.runExecline.local name { stdin = moduleString; } [
       "importas" "out" "out"
@@ -30,10 +38,18 @@ let
       doCheck = false;
     };
 
-  tests = import ./tests.nix { inherit depot pkgs python3Lib; };
+  tests = import ./tests.nix {
+    inherit
+      depot
+      pkgs
+      python3
+      python3Lib
+      ;
+   };
 
 in {
   inherit
+    python3
     python3Lib
     tests
     ;
diff --git a/users/Profpatsch/writers/tests.nix b/users/Profpatsch/writers/tests.nix
index 4cae230e0e6d..13ddfd10e976 100644
--- a/users/Profpatsch/writers/tests.nix
+++ b/users/Profpatsch/writers/tests.nix
@@ -1,19 +1,28 @@
-{ depot, pkgs, python3Lib }:
+{ depot, pkgs, python3, python3Lib }:
 
 let
+  transitiveLib = python3Lib {
+    name = "transitive";
+  } ''
+    def transitive(s):
+      return s + " 1 2 3"
+  '';
+
   testLib = python3Lib {
     name = "test_lib";
+    libraries = _: [ transitiveLib ];
   } ''
+    import transitive
     def test():
-      return "test"
+      return transitive.transitive("test")
   '';
 
-  pythonWithLib = pkgs.writers.writePython3 "python-with-lib" {
-    libraries = [ testLib ];
+  pythonWithLib = python3 "python-with-lib" {
+    libraries = _: [ testLib ];
   } ''
     import test_lib
 
-    assert(test_lib.test() == "test")
+    assert(test_lib.test() == "test 1 2 3")
   '';
 
 in {