From dacc1dab3e67b5305e395b02692cd914e8cdec4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Fri, 6 Jun 2025 11:07:50 -0700 Subject: [PATCH 1/2] python3Packages.coverage: modernize --- .../python-modules/coverage/default.nix | 77 +++++++++++++++---- 1 file changed, 62 insertions(+), 15 deletions(-) diff --git a/pkgs/development/python-modules/coverage/default.nix b/pkgs/development/python-modules/coverage/default.nix index b41192c54dd3..bca4d03d4a51 100644 --- a/pkgs/development/python-modules/coverage/default.nix +++ b/pkgs/development/python-modules/coverage/default.nix @@ -1,10 +1,14 @@ { lib, buildPythonPackage, - fetchPypi, - mock, + fetchFromGitHub, + flaky, + hypothesis, + pytest-xdist, + pytestCheckHook, pythonOlder, setuptools, + tomli, }: buildPythonPackage rec { @@ -12,23 +16,66 @@ buildPythonPackage rec { version = "7.8.0"; pyproject = true; - # uses f strings - disabled = pythonOlder "3.5"; - - src = fetchPypi { - inherit pname version; - hash = "sha256-ej1is7A7S2/UGghfNXSHTPlGy0YE0rTT6NyozVcMpQE="; + src = fetchFromGitHub { + owner = "nedbat"; + repo = "coveragepy"; + tag = version; + hash = "sha256-clnwx9Fa75aLfGe/MZVtIzE8Ah5EY7MQf8g11TSkl/c="; }; - nativeBuildInputs = [ setuptools ]; + postPatch = '' + # don't write to Nix store + substituteInPlace tests/conftest.py \ + --replace-fail 'if WORKER == "none":' "if False:" + ''; - # No tests in archive - doCheck = false; - nativeCheckInputs = [ mock ]; + build-system = [ setuptools ]; + + optional-dependencies = { + toml = lib.optionals (pythonOlder "3.11") [ + tomli + ]; + }; + + nativeCheckInputs = [ + flaky + hypothesis + pytest-xdist + pytestCheckHook + ]; + + preCheck = '' + export PATH="$PATH:$out/bin" + # import from $out + rm -r coverage + ''; + + disabledTests = [ + "test_all_our_source_files" + "test_doctest" + "test_files_up_one_level" + "test_get_encoded_zip_files" + "test_metadata" + "test_more_metadata" + "test_multi" + "test_no_duplicate_packages" + "test_xdist_sys_path_nuttiness_is_fixed" + "test_zipfile" + ]; + + disabledTestPaths = [ + "tests/test_debug.py" + "tests/test_plugins.py" + "tests/test_process.py" + "tests/test_report.py" + "tests/test_venv.py" + ]; meta = { - description = "Code coverage measurement for python"; - homepage = "https://coverage.readthedocs.io/"; - license = lib.licenses.bsd3; + changelog = "https://github.com/nedbat/coveragepy/blob/${src.tag}/CHANGES.rst"; + description = "Code coverage measurement for Python"; + homepage = "https://github.com/nedbat/coveragepy"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ dotlambda ]; }; } From 04234a7c5db3dceac785567ac63a24984cb75c89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Fri, 6 Jun 2025 11:45:13 -0700 Subject: [PATCH 2/2] python3Packages.coverage: 7.8.0 -> 7.8.2 Diff: https://github.com/nedbat/coveragepy/compare/refs/tags/7.8.0...refs/tags/7.8.2 Changelog: https://github.com/nedbat/coveragepy/blob/7.8.2/CHANGES.rst --- pkgs/development/python-modules/coverage/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/coverage/default.nix b/pkgs/development/python-modules/coverage/default.nix index bca4d03d4a51..6139480d86f5 100644 --- a/pkgs/development/python-modules/coverage/default.nix +++ b/pkgs/development/python-modules/coverage/default.nix @@ -13,14 +13,14 @@ buildPythonPackage rec { pname = "coverage"; - version = "7.8.0"; + version = "7.8.2"; pyproject = true; src = fetchFromGitHub { owner = "nedbat"; repo = "coveragepy"; tag = version; - hash = "sha256-clnwx9Fa75aLfGe/MZVtIzE8Ah5EY7MQf8g11TSkl/c="; + hash = "sha256-PCMGxyG5zIc8iigi9BsuhyuyQindZnewqTgxErT/jHw="; }; postPatch = ''