1{ lib, buildPythonPackage, fetchPypi,
2 nose, dbus, dbus-python, pygobject3,
3 which, pyflakes, pycodestyle, bluez, networkmanager
4}:
5
6buildPythonPackage rec {
7 pname = "python-dbusmock";
8 version = "0.18.1";
9
10 src = fetchPypi {
11 inherit pname version;
12 sha256 = "1hj02p65cic4jdc6a5xf1hx8j5icwy7dcrm5kg91lkjks4gwpg5h";
13 };
14
15 prePatch = ''
16 sed -i -e 's|pyflakes3|pyflakes|g' tests/test_code.py;
17 '';
18
19 # TODO: Get the rest of these tests running?
20 # This is a mocking library used as a check dependency for a single derivation.
21 # That derivation's tests pass. Maybe not worth the effort to fix these...
22 NOSE_EXCLUDE = lib.concatStringsSep "," [
23 "test_bluez4" # NixOS ships BlueZ5
24 # These appear to fail because they're expecting to run in an Ubuntu chroot?
25 "test_everything" # BlueZ5 OBEX
26 "test_polkitd"
27 "test_consolekit"
28 "test_api"
29 "test_logind"
30 "test_notification_daemon"
31 "test_ofono"
32 "test_gnome_screensaver"
33 "test_cli"
34 "test_timedated"
35 "test_upower"
36 # Very slow, consider disabling?
37 # "test_networkmanager"
38 ];
39
40 checkInputs = [
41 nose dbus dbus-python which pycodestyle pyflakes
42 pygobject3 bluez bluez.test networkmanager
43 ];
44
45 checkPhase = ''
46 runHook preCheck
47 export PATH="$PATH:${bluez.test}/test";
48 nosetests -v
49 runHook postCheck
50 '';
51
52 meta = with lib; {
53 description = "Mock D-Bus objects for tests";
54 homepage = https://github.com/martinpitt/python-dbusmock;
55 license = licenses.lgpl3Plus;
56 maintainers = with maintainers; [ callahad ];
57 platforms = platforms.linux;
58 };
59}