Merge pull request #114249 from veprbl/pr/psutil_test_fix

This commit is contained in:
Sandro 2021-03-04 19:36:02 +01:00 committed by GitHub
commit 9f7ce23482
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,6 +1,6 @@
{ lib, stdenv, buildPythonPackage, fetchPypi, isPy27, python
, darwin
, pytest
, pytestCheckHook
, mock
, ipaddress
, unittest2
@ -18,15 +18,20 @@ 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"
"cpu_freq"
];
buildInputs = lib.optionals stdenv.isDarwin [ darwin.IOKit ];