1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 isPy312,
6 fetchFromGitHub,
7 flaky,
8 hypothesis,
9 pytest-xdist,
10 pytestCheckHook,
11 pythonOlder,
12 setuptools,
13 tomli,
14}:
15
16buildPythonPackage rec {
17 pname = "coverage";
18 version = "7.10.5";
19 pyproject = true;
20
21 src = fetchFromGitHub {
22 owner = "nedbat";
23 repo = "coveragepy";
24 tag = version;
25 hash = "sha256-jsocpziOu0fSmFn075vj2u1SCZkG7M/kuRujaJ1OeH4=";
26 };
27
28 build-system = [ setuptools ];
29
30 optional-dependencies = {
31 toml = lib.optionals (pythonOlder "3.11") [
32 tomli
33 ];
34 };
35
36 nativeCheckInputs = [
37 flaky
38 hypothesis
39 pytest-xdist
40 pytestCheckHook
41 ];
42
43 preCheck = ''
44 export PATH="$PATH:$out/bin"
45 # import from $out
46 rm -r coverage
47 '';
48
49 disabledTests = [
50 "test_doctest"
51 "test_files_up_one_level"
52 "test_get_encoded_zip_files"
53 "test_multi"
54 "test_no_duplicate_packages"
55 "test_zipfile"
56 # tests expect coverage source to be there
57 "test_all_our_source_files"
58 "test_metadata"
59 "test_more_metadata"
60 "test_real_code_regions"
61 ];
62
63 disabledTestPaths = [
64 "tests/test_debug.py"
65 "tests/test_plugins.py"
66 "tests/test_process.py"
67 "tests/test_report.py"
68 "tests/test_venv.py"
69 ];
70
71 meta = {
72 changelog = "https://github.com/nedbat/coveragepy/blob/${src.tag}/CHANGES.rst";
73 description = "Code coverage measurement for Python";
74 homepage = "https://github.com/nedbat/coveragepy";
75 license = lib.licenses.asl20;
76 maintainers = with lib.maintainers; [ dotlambda ];
77 };
78}