From ce9b57bc3949333318bfa207074c9f3e9f4905cf Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Wed, 24 Feb 2021 10:23:35 -0500 Subject: [PATCH 1/2] pythonPackages.psutils: use pytestCheckHook --- .../python-modules/psutil/default.nix | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/pkgs/development/python-modules/psutil/default.nix b/pkgs/development/python-modules/psutil/default.nix index 6760ff168e5..0871ca6a208 100644 --- a/pkgs/development/python-modules/psutil/default.nix +++ b/pkgs/development/python-modules/psutil/default.nix @@ -1,6 +1,6 @@ { lib, stdenv, buildPythonPackage, fetchPypi, isPy27, python , darwin -, pytest +, pytestCheckHook , mock , ipaddress , unittest2 @@ -18,15 +18,19 @@ buildPythonPackage rec { # arch doesn't report frequency is the same way # tests segfaults on darwin https://github.com/giampaolo/psutil/issues/1715 doCheck = !stdenv.isDarwin && stdenv.isx86_64; - checkInputs = [ pytest ] + checkInputs = [ pytestCheckHook ] ++ lib.optionals isPy27 [ mock ipaddress unittest2 ]; - # out must be referenced as test import paths are relative + pytestFlagsArray = [ + "$out/${python.sitePackages}/psutil/tests/test_system.py" + ]; # disable tests which don't work in sandbox # cpu_times is flakey on darwin - checkPhase = '' - pytest $out/${python.sitePackages}/psutil/tests/test_system.py \ - -k 'not user and not disk_io_counters and not sensors_battery and not cpu_times' - ''; + disabledTests = [ + "user" + "disk_io_counters" + "sensors_battery" + "cpu_times" + ]; buildInputs = lib.optionals stdenv.isDarwin [ darwin.IOKit ]; From 4f702f7e3063c655eb3daff7aeef6d10b09fae74 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Wed, 24 Feb 2021 10:29:39 -0500 Subject: [PATCH 2/2] pythonPackages.psutil: disable impure cpu_freq test Tries to reach into /sys/devices/system/cpu, which may fail on non-NixOS. --- pkgs/development/python-modules/psutil/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/development/python-modules/psutil/default.nix b/pkgs/development/python-modules/psutil/default.nix index 0871ca6a208..a53005c7426 100644 --- a/pkgs/development/python-modules/psutil/default.nix +++ b/pkgs/development/python-modules/psutil/default.nix @@ -30,6 +30,7 @@ buildPythonPackage rec { "disk_io_counters" "sensors_battery" "cpu_times" + "cpu_freq" ]; buildInputs = lib.optionals stdenv.isDarwin [ darwin.IOKit ];