nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib, buildPythonPackage, fetchFromGitHub, runtimeShell,
2 nose, dbus, dbus-python, pygobject3,
3 which, pyflakes, pycodestyle, bluez, networkmanager
4}:
5
6buildPythonPackage rec {
7 pname = "python-dbusmock";
8 version = "0.26.1";
9
10 src = fetchFromGitHub {
11 owner = "martinpitt";
12 repo = pname;
13 rev = version;
14 sha256 = "sha256-kavbWMTgKU/rBIo7RMs9NkwReYQyEdeFwMBSzEM9wa0=";
15 };
16
17 prePatch = ''
18 substituteInPlace tests/test_code.py \
19 --replace "pyflakes3" "pyflakes" \
20 --replace "/bin/bash" "${runtimeShell}" \
21 --replace "--ignore=E124,E402,E731,W504" "--ignore=E124,E402,E731,W504,E501" # ignore long lines too
22 '';
23
24 # TODO: Get the rest of these tests running?
25 # This is a mocking library used as a check dependency for a single derivation.
26 # That derivation's tests pass. Maybe not worth the effort to fix these...
27 NOSE_EXCLUDE = lib.concatStringsSep "," [
28 "test_bluez4" # NixOS ships BlueZ5
29 # These appear to fail because they're expecting to run in an Ubuntu chroot?
30 "test_everything" # BlueZ5 OBEX
31 "test_polkitd"
32 "test_consolekit"
33 "test_api"
34 "test_logind"
35 "test_notification_daemon"
36 "test_ofono"
37 "test_gnome_screensaver"
38 "test_cli"
39 "test_timedated"
40 "test_upower"
41 # needs glib
42 "test_accounts_service"
43 # needs dbus-daemon active
44 "test_systemd"
45 # Very slow, consider disabling?
46 # "test_networkmanager"
47 ];
48
49 checkInputs = [
50 nose dbus dbus-python which pycodestyle pyflakes
51 pygobject3 bluez (lib.getOutput "test" bluez) networkmanager
52 ];
53
54 checkPhase = ''
55 runHook preCheck
56 export PATH="$PATH:${lib.getOutput "test" bluez}/test";
57 nosetests -v
58 runHook postCheck
59 '';
60
61 meta = with lib; {
62 description = "Mock D-Bus objects for tests";
63 homepage = "https://github.com/martinpitt/python-dbusmock";
64 license = licenses.lgpl3Plus;
65 maintainers = with maintainers; [ callahad ];
66 platforms = platforms.linux;
67 };
68}