summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Olsen <daniel.olsen99@gmail.com>2021-06-24 23:34:03 +0200
committerDaniel Olsen <daniel.olsen99@gmail.com>2021-06-24 23:34:03 +0200
commitf7f52a4fbf9cce72ec5be144ac5e665071f0da61 (patch)
tree005a7bc06f230855fc284527424d66d4d0b22200
parent6d90bc1c110dc4bb06d253210be51ea97633fac9 (diff)
downloadnixpkgs-f7f52a4fbf9cce72ec5be144ac5e665071f0da61.tar
nixpkgs-f7f52a4fbf9cce72ec5be144ac5e665071f0da61.tar.gz
nixpkgs-f7f52a4fbf9cce72ec5be144ac5e665071f0da61.tar.bz2
nixpkgs-f7f52a4fbf9cce72ec5be144ac5e665071f0da61.tar.lz
nixpkgs-f7f52a4fbf9cce72ec5be144ac5e665071f0da61.tar.xz
nixpkgs-f7f52a4fbf9cce72ec5be144ac5e665071f0da61.tar.zst
nixpkgs-f7f52a4fbf9cce72ec5be144ac5e665071f0da61.zip
pythonPackages.txredisapi: Add unit test
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/txredisapi.nix27
-rw-r--r--pkgs/development/python-modules/txredisapi/default.nix2
3 files changed, 30 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index e8c86394831..a8e06a0cee1 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -431,6 +431,7 @@ in
   trezord = handleTest ./trezord.nix {};
   trickster = handleTest ./trickster.nix {};
   trilium-server = handleTestOn ["x86_64-linux"] ./trilium-server.nix {};
+  txredisapi = handleTest ./txredisapi.nix {};
   tuptime = handleTest ./tuptime.nix {};
   turbovnc-headless-server = handleTest ./turbovnc-headless-server.nix {};
   ucarp = handleTest ./ucarp.nix {};
diff --git a/nixos/tests/txredisapi.nix b/nixos/tests/txredisapi.nix
new file mode 100644
index 00000000000..bc3814a7137
--- /dev/null
+++ b/nixos/tests/txredisapi.nix
@@ -0,0 +1,27 @@
+import ./make-test-python.nix ({ pkgs, ... }:
+{
+  name = "txredisapi";
+  meta = with pkgs.lib.maintainers; {
+    maintainers = [ dandellion ];
+  };
+
+  nodes = {
+    machine =
+      { pkgs, ... }:
+
+      {
+        services.redis.enable = true;
+        services.redis.unixSocket = "/run/redis/redis.sock";
+
+        environment.systemPackages = with pkgs; [ (python38.withPackages (ps: [ ps.twisted ps.txredisapi ps.mock ]))];
+      };
+  };
+
+  testScript = ''
+    start_all()
+    machine.wait_for_unit("redis")
+    machine.wait_for_open_port("6379")
+
+    tests = machine.succeed("PYTHONPATH=\"${pkgs.python3Packages.txredisapi.src}\" python -m twisted.trial ${pkgs.python3Packages.txredisapi.src}/tests")
+  '';
+})
diff --git a/pkgs/development/python-modules/txredisapi/default.nix b/pkgs/development/python-modules/txredisapi/default.nix
index 00da16c040f..9d8b268b30b 100644
--- a/pkgs/development/python-modules/txredisapi/default.nix
+++ b/pkgs/development/python-modules/txredisapi/default.nix
@@ -16,6 +16,8 @@ buildPythonPackage rec {
   doCheck = false;
   pythonImportsCheck = [ "txredisapi" ];
 
+  passthru.tests.unit-tests = nixosTests.txredisapi;
+
   meta = with lib; {
     homepage = "https://github.com/IlyaSkriblovsky/txredisapi";
     description = "non-blocking redis client for python";