python3Packages.notify-py: fix tests
Previously tests failed on Linux with Cannot spawn a message bus without a machine-id
This commit is contained in:
parent
e680b5cf74
commit
b053f97b3d
1 changed files with 21 additions and 7 deletions
|
@ -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" ];
|
||||
|
|
Loading…
Reference in a new issue