@@ -1,5 +1,6 @@
1−{ buildPythonApplication
1+{ stdenv
22, lib
3+, buildPythonApplication
34, fetchFromGitHub
45, dateutil
56, pandas
@@ -18,6 +19,7 @@
1819, wcwidth
1920, zstandard
2021, setuptools
22+, git
2123, withPcap ? true, dpkt, dnslib
2224}:
2325buildPythonApplication rec {
@@ -61,7 +63,33 @@ buildPythonApplication rec {
6163 setuptools
6264 ] ++ lib.optionals withPcap [ dpkt dnslib ];
6365
64− doCheck = false;
66+ checkInputs = [
67+ git
68+ ];
69+
70+ # check phase uses the output bin, which is not possible when cross-compiling
71+ doCheck = stdenv.buildPlatform == stdenv.hostPlatform;
72+
73+ checkPhase = ''
74+ # disable some tests which require access to the network
75+ rm tests/load-http.vd # http
76+ rm tests/graph-cursor-nosave.vd # http
77+ rm tests/messenger-nosave.vd # dns
78+
79+ # disable some tests which expect Python == 3.6 (not our current version)
80+ # see https://github.com/saulpw/visidata/issues/1014
81+ rm tests/describe.vd
82+ rm tests/describe-error.vd
83+ rm tests/edit-type.vd
84+
85+ # tests use git to compare outputs to references
86+ git init -b "test-reference"
87+ git config user.name "nobody"; git config user.email "no@where"
88+ git add .; git commit -m "test reference"
89+
90+ substituteInPlace dev/test.sh --replace "bin/vd" "$out/bin/vd"
91+ bash dev/test.sh
92+ '';
6593
6694 meta = {
6795 inherit version;