@@ -1,26 +1,41 @@
1−{ stdenv
2−, buildPythonPackage
3−, fetchPypi
1+{ lib, stdenv, buildPythonPackage, fetchPypi, isPy27, python
42, darwin
3+, pytest
4+, mock
5+, ipaddress
56}:
67
78buildPythonPackage rec {
89 pname = "psutil";
9− version = "5.6.7";
10+ version = "5.7.0";
1011
1112 src = fetchPypi {
1213 inherit pname version;
13− sha256 = "ffad8eb2ac614518bbe3c0b8eb9dffdb3a8d2e3a7d5da51c5b974fb723a5c5aa";
14+ sha256 = "03jykdi3dgf1cdal9bv4fq9zjvzj9l9bs99gi5ar81sdl5nc2pk8";
1415 };
1516
16− # No tests in archive
17− doCheck = false;
17+ # arch doesn't report frequency is the same way
18+ doCheck = stdenv.isx86_64;
19+ checkInputs = [ pytest ]
20+ ++ lib.optionals isPy27 [ mock ipaddress ];
21+ # out must be referenced as test import paths are relative
22+ # disable tests which don't work in sandbox
23+ # cpu_times is flakey on darwin
24+ checkPhase = ''
25+ pytest $out/${python.sitePackages}/psutil/tests/test_system.py \
26+ -k 'not user \
27+ and not disk_io_counters and not sensors_battery \
28+ and not cpu_times'
29+ '';
1830
19− buildInputs = [] ++ stdenv.lib.optionals stdenv.isDarwin [ darwin.IOKit ];
31+ buildInputs = lib.optionals stdenv.isDarwin [ darwin.IOKit ];
2032
21− meta = {
33+ pythonImportsCheck = [ "psutil" ];
34+
35+ meta = with lib; {
2236 description = "Process and system utilization information interface for python";
23− homepage = https://github.com/giampaolo/psutil;
24− license = stdenv.lib.licenses.bsd3;
37+ homepage = "https://github.com/giampaolo/psutil";
38+ license = licenses.bsd3;
39+ maintainers = with maintainers; [ jonringer ];
2540 };
2641}