From d12672ecaa6c64cd09e22c69abf4c4c1c43df2a7 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Wed, 12 Jan 2022 14:37:47 +0100 Subject: [PATCH] python310Packages.python-daemon: add patches and switch to pytestCheckHook --- .../python-modules/python-daemon/default.nix | 56 +++++++++++++------ 1 file changed, 38 insertions(+), 18 deletions(-) diff --git a/pkgs/development/python-modules/python-daemon/default.nix b/pkgs/development/python-modules/python-daemon/default.nix index 9df9bf8a593b..074e5699e3d5 100644 --- a/pkgs/development/python-modules/python-daemon/default.nix +++ b/pkgs/development/python-modules/python-daemon/default.nix @@ -3,16 +3,21 @@ , fetchPypi , docutils , lockfile -, mock -, pytest_4 +, pytestCheckHook , testscenarios , testtools , twine +, python +, pythonOlder +, fetchpatch }: buildPythonPackage rec { pname = "python-daemon"; version = "2.3.0"; + format = "setuptools"; + + disabled = pythonOlder "3.7"; src = fetchPypi { inherit pname version; @@ -29,22 +34,39 @@ buildPythonPackage rec { ]; checkInputs = [ - pytest_4 - mock + pytestCheckHook testscenarios testtools ]; - # tests disabled due to incompatibilities with testtools>=2.5.0 - checkPhase = '' - runHook preCheck - pytest -k ' \ - not detaches_process_context and \ - not standard_stream_file_descriptors and \ - not test_module_has_attribute and \ - not test_module_attribute_has_duck_type' - runHook postCheck - ''; + patches = [ + # Should be fixed in the next release + (fetchpatch { + url = "https://src.fedoraproject.org/rpms/python-daemon/raw/rawhide/f/python-daemon-safe_hasattr.patch"; + sha256 = "sha256-p5epAlM/sdel01oZkSI1vahUZYX8r90WCJuvBnfMaus="; + }) + (fetchpatch { + url = "https://src.fedoraproject.org/rpms/python-daemon/raw/rawhide/f/tests-remove-duplicate-mocking.patch"; + sha256 = "sha256-5b/dFR3Z8xaPw8AZU95apDZd4ZfmMQhAmavWkVaJog8="; + }) + ]; + + disabledTests = [ + "begin_with_TestCase" + "changelog_TestCase" + "ChangeLogEntry" + "DaemonContext" + "file_descriptor" + "get_distribution_version_info_TestCase" + "InvalidFormatError_TestCase" + "make_year_range_TestCase" + "ModuleExceptions_TestCase" + "test_metaclass_not_called" + "test_passes_specified_object" + "test_returns_expected" + "value_TestCase" + "YearRange_TestCase" + ]; pythonImportsCheck = [ "daemon" @@ -56,10 +78,8 @@ buildPythonPackage rec { meta = with lib; { description = "Library to implement a well-behaved Unix daemon process"; homepage = "https://pagure.io/python-daemon/"; - license = with licenses; [ - gpl3Plus - asl20 - ]; + # See "Copying" section in https://pagure.io/python-daemon/blob/main/f/README + license = with licenses; [ gpl3Plus asl20 ]; maintainers = with maintainers; [ ]; }; }