about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSandro <sandro.jaeckel@gmail.com>2022-05-12 20:45:51 +0200
committerGitHub <noreply@github.com>2022-05-12 20:45:51 +0200
commit914c76f1004c6e0770e6129b6c2b3673fb2c887f (patch)
treeb0d2d2cc3db6e065503afd26ba9848142d9fb0b2
parentd89d7af1ba23bd8a5341d00bdd862e8e9a808f56 (diff)
parentb053f97b3d6284b0a945c09c9e45d1852c01fb85 (diff)
downloadnixlib-914c76f1004c6e0770e6129b6c2b3673fb2c887f.tar
nixlib-914c76f1004c6e0770e6129b6c2b3673fb2c887f.tar.gz
nixlib-914c76f1004c6e0770e6129b6c2b3673fb2c887f.tar.bz2
nixlib-914c76f1004c6e0770e6129b6c2b3673fb2c887f.tar.lz
nixlib-914c76f1004c6e0770e6129b6c2b3673fb2c887f.tar.xz
nixlib-914c76f1004c6e0770e6129b6c2b3673fb2c887f.tar.zst
nixlib-914c76f1004c6e0770e6129b6c2b3673fb2c887f.zip
Merge pull request #172622 from dotlambda/notify-py-fix
python3Packages.notify-py: fix tests
-rw-r--r--pkgs/development/python-modules/notify-py/default.nix28
1 files changed, 21 insertions, 7 deletions
diff --git a/pkgs/development/python-modules/notify-py/default.nix b/pkgs/development/python-modules/notify-py/default.nix
index 497b20d3df8f..6d255424812e 100644
--- a/pkgs/development/python-modules/notify-py/default.nix
+++ b/pkgs/development/python-modules/notify-py/default.nix
@@ -9,7 +9,8 @@
 , which
 , jeepney
 , loguru
-, pytestCheckHook
+, pytest
+, dbus
 , coreutils
 }:
 
@@ -41,16 +42,29 @@ buildPythonPackage rec {
     })
   ];
 
-  propagatedBuildInputs = [ loguru ]
-    ++ lib.optionals stdenv.isLinux [ jeepney ];
+  propagatedBuildInputs = [
+    loguru
+  ] ++ lib.optionals stdenv.isLinux [
+    jeepney
+  ];
 
-  checkInputs = [ pytestCheckHook ];
+  checkInputs = [
+    pytest
+  ] ++ lib.optionals stdenv.isLinux [
+    dbus
+  ];
 
-  # Tests search for "afplay" binary which is built in to MacOS and not available in nixpkgs
-  preCheck = lib.optionalString stdenv.isDarwin ''
+  checkPhase = if stdenv.isDarwin then ''
+    # Tests search for "afplay" binary which is built in to macOS and not available in nixpkgs
     mkdir $TMP/bin
     ln -s ${coreutils}/bin/true $TMP/bin/afplay
-    export PATH="$TMP/bin:$PATH"
+    PATH="$TMP/bin:$PATH" pytest
+  '' else if stdenv.isLinux then ''
+    dbus-run-session \
+      --config-file=${dbus.daemon}/share/dbus-1/session.conf \
+      pytest
+  '' else ''
+    pytest
   '';
 
   pythonImportsCheck = [ "notifypy" ];