1{stdenv, lib, buildPythonPackage, fetchPypi, coverage, bash, which, writeText}:
2
3buildPythonPackage rec {
4 name = "${pname}-${version}";
5 version = "0.7";
6 pname = "cram";
7
8 buildInputs = [ coverage which ];
9
10 src = fetchPypi {
11 inherit pname version;
12 sha256 = "0bvz6fwdi55rkrz3f50zsy35gvvwhlppki2yml5bj5ffy9d499vx";
13 };
14
15 postPatch = ''
16 substituteInPlace tests/test.t \
17 --replace "/bin/bash" "${bash}/bin/bash"
18 '';
19
20 # This testing is copied from Makefile. Simply using `make test` doesn't work
21 # because it uses the unpatched `scripts/cram` executable which has a bad
22 # shebang. Also, for some reason, coverage fails on one file so let's just
23 # ignore that one.
24 checkPhase = ''
25 # scripts/cram tests
26 #COVERAGE=${coverage}/bin/coverage $out/bin/cram tests
27 #${coverage}/bin/coverage report --fail-under=100
28 COVERAGE=coverage $out/bin/cram tests
29 coverage report --fail-under=100 --omit="*/_encoding.py,*/__main__.py"
30 '';
31
32 meta = {
33 description = "A simple testing framework for command line applications";
34 homepage = https://bitheap.org/cram/;
35 license = lib.licenses.gpl2Plus;
36 maintainers = with lib.maintainers; [ jluttine ];
37 # Tests fail on i686: https://hydra.nixos.org/build/52896671/nixlog/4
38 broken = stdenv.isi686;
39 };
40}