Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
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.2";
19 pyproject = true;
20
21 src = fetchFromGitHub {
22 owner = "nedbat";
23 repo = "coveragepy";
24 tag = version;
25 hash = "sha256-OXi5FCLcfhseNDerwHdsVHF31Jy+ZSz2RU05vqPxQis=";
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_all_our_source_files"
51 "test_doctest"
52 "test_files_up_one_level"
53 "test_get_encoded_zip_files"
54 "test_metadata"
55 "test_more_metadata"
56 "test_multi"
57 "test_no_duplicate_packages"
58 "test_xdist_sys_path_nuttiness_is_fixed"
59 "test_zipfile"
60 ]
61 ++ lib.optionals (isPy312 && stdenv.hostPlatform.system == "x86_64-darwin") [
62 # substring that may not be in string is part of the pytest output hash, which appears in the string
63 "test_nothing_specified"
64 "test_omit"
65 "test_omit_2"
66 "test_omit_as_string"
67 ];
68
69 disabledTestPaths = [
70 "tests/test_debug.py"
71 "tests/test_plugins.py"
72 "tests/test_process.py"
73 "tests/test_report.py"
74 "tests/test_venv.py"
75 ];
76
77 meta = {
78 changelog = "https://github.com/nedbat/coveragepy/blob/${src.tag}/CHANGES.rst";
79 description = "Code coverage measurement for Python";
80 homepage = "https://github.com/nedbat/coveragepy";
81 license = lib.licenses.asl20;
82 maintainers = with lib.maintainers; [ dotlambda ];
83 };
84}