pythonPackages.psutils: use pytestCheckHook

This commit is contained in:
Dmitry Kalinkin 2021-02-24 10:23:35 -05:00
parent 5dcd93de33
commit ce9b57bc39
No known key found for this signature in database
GPG Key ID: 5157B3EC8B2CA333

View File

@ -1,6 +1,6 @@
{ lib, stdenv, buildPythonPackage, fetchPypi, isPy27, python { lib, stdenv, buildPythonPackage, fetchPypi, isPy27, python
, darwin , darwin
, pytest , pytestCheckHook
, mock , mock
, ipaddress , ipaddress
, unittest2 , unittest2
@ -18,15 +18,19 @@ buildPythonPackage rec {
# arch doesn't report frequency is the same way # arch doesn't report frequency is the same way
# tests segfaults on darwin https://github.com/giampaolo/psutil/issues/1715 # tests segfaults on darwin https://github.com/giampaolo/psutil/issues/1715
doCheck = !stdenv.isDarwin && stdenv.isx86_64; doCheck = !stdenv.isDarwin && stdenv.isx86_64;
checkInputs = [ pytest ] checkInputs = [ pytestCheckHook ]
++ lib.optionals isPy27 [ mock ipaddress unittest2 ]; ++ 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 # disable tests which don't work in sandbox
# cpu_times is flakey on darwin # cpu_times is flakey on darwin
checkPhase = '' disabledTests = [
pytest $out/${python.sitePackages}/psutil/tests/test_system.py \ "user"
-k 'not user and not disk_io_counters and not sensors_battery and not cpu_times' "disk_io_counters"
''; "sensors_battery"
"cpu_times"
];
buildInputs = lib.optionals stdenv.isDarwin [ darwin.IOKit ]; buildInputs = lib.optionals stdenv.isDarwin [ darwin.IOKit ];