about summary refs log tree commit diff
path: root/users/Profpatsch/writers/tests.nix
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2021-01-01T19·00+0100
committerProfpatsch <mail@profpatsch.de>2021-01-03T16·12+0000
commit6b21b108ba07201e6471444961fa217c33b383c1 (patch)
treeac5909afb1207c4f0af465918f0390492bfd73fb /users/Profpatsch/writers/tests.nix
parent533e365c12b5097005626317171b789406c1780f (diff)
feat(users/Profpatsch): add writers.python3 r/2052
This is a reexport of nixpkgs.writers.writePython3, but the libraries
are passed the package set, like with other writers.

Change-Id: Ia5a2ed1b6b329700836a8575d2bde768bf64fb31
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2311
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
Diffstat (limited to 'users/Profpatsch/writers/tests.nix')
-rw-r--r--users/Profpatsch/writers/tests.nix19
1 files changed, 14 insertions, 5 deletions
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 {