-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.nix
48 lines (42 loc) · 1.25 KB
/
tests.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
let
sources = import ./nix/sources.nix;
in
{ pkgs ? import sources.nixpkgs { }
, pypiData ? sources.pypi-deps-db
, python ? "python39"
, mach-nix ? import sources.mach-nix { inherit pkgs pypiData python; }
}:
let
pkg = mach-nix.buildPythonPackage {
python = "python39";
src = ./.;
pname = "circleci-python-coverage";
version = "2022.05.13";
requirements = ''
setuptools
'';
};
python = mach-nix.mkPython {
python = "python39";
requirements = ''
coverage
coverage_enable_subprocess
slipcover
'';
packagesExtra = [ pkg ];
};
tests = pkgs.runCommand "circleci-python-coverage" {
} ''
set -x
${python}/bin/python -m coverage run --rcfile=${pkg.src}/.coveragerc --debug=config -m circleci_python_coverage.tests.test_coveragepy --verbose
SOURCE=$(${python}/bin/python -c 'import circleci_python_coverage; print(circleci_python_coverage.__file__.rsplit("/", 1)[0])')
${python}/bin/python -m slipcover --source $SOURCE --json --pretty-print --out slipcover.json -m circleci_python_coverage.tests.test_slipcover --verbose
${python}/bin/python -m coverage report
${python}/bin/python -m coverage html
mkdir $out
mv .coverage* slipcover.json $out/
'';
in
{
inherit pkg tests;
}