From d0a0625e3c2bcf074454e94ff129e65d251e8453 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Mon, 3 Jan 2022 22:25:47 +0100 Subject: [PATCH 1/2] python3Packages.requests-toolbelt: switch to pytestCheckHook --- .../requests-toolbelt/default.nix | 42 ++++++++++++------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/pkgs/development/python-modules/requests-toolbelt/default.nix b/pkgs/development/python-modules/requests-toolbelt/default.nix index 3ad219025a92..07c87bb17c0a 100644 --- a/pkgs/development/python-modules/requests-toolbelt/default.nix +++ b/pkgs/development/python-modules/requests-toolbelt/default.nix @@ -1,36 +1,48 @@ { lib +, betamax , buildPythonPackage , fetchPypi -, requests -, betamax , mock -, pytest , pyopenssl +, pytestCheckHook +, requests }: buildPythonPackage rec { pname = "requests-toolbelt"; version = "0.9.1"; + format = "setuptools"; src = fetchPypi { inherit pname version; - sha256 = "968089d4584ad4ad7c171454f0a5c6dac23971e9472521ea3b6d49d610aa6fc0"; + hash = "sha256-loCJ1FhK1K18FxRU8KXG2sI5celHJSHqO21J1hCqb8A="; }; - checkInputs = [ pyopenssl betamax mock pytest ]; - propagatedBuildInputs = [ requests ]; + propagatedBuildInputs = [ + requests + ]; - checkPhase = '' - # disabled tests access the network - py.test tests -k "not test_no_content_length_header \ - and not test_read_file \ - and not test_reads_file_from_url_wrapper \ - and not test_x509_der \ - and not test_x509_pem" - ''; + checkInputs = [ + betamax + mock + pyopenssl + pytestCheckHook + ]; + + disabledTests = [ + "test_no_content_length_header" + "test_read_file" + "test_reads_file_from_url_wrapper" + "test_x509_der" + "test_x509_pem" + ]; + + pythonImportsCheck = [ + "requests_toolbelt" + ]; meta = { - description = "A toolbelt of useful classes and functions to be used with python-requests"; + description = "Toolbelt of useful classes and functions to be used with requests"; homepage = "http://toolbelt.rtfd.org"; license = lib.licenses.asl20; maintainers = with lib.maintainers; [ matthiasbeyer ]; From 6b98aa0d5469f20c01835bbf36f0400e19ff0c08 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Tue, 11 Jan 2022 09:28:14 +0100 Subject: [PATCH 2/2] python3Packages.requests-toolbelt: disable warnings --- .../requests-toolbelt/default.nix | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/pkgs/development/python-modules/requests-toolbelt/default.nix b/pkgs/development/python-modules/requests-toolbelt/default.nix index 07c87bb17c0a..0417154a4a31 100644 --- a/pkgs/development/python-modules/requests-toolbelt/default.nix +++ b/pkgs/development/python-modules/requests-toolbelt/default.nix @@ -1,6 +1,7 @@ { lib , betamax , buildPythonPackage +, fetchpatch , fetchPypi , mock , pyopenssl @@ -29,7 +30,17 @@ buildPythonPackage rec { pytestCheckHook ]; + patches = [ + (fetchpatch { + # Fix collections.abc deprecation warning, https://github.com/requests/toolbelt/pull/246 + name = "fix-collections-abc-deprecation.patch"; + url = "https://github.com/requests/toolbelt/commit/7188b06330e5260be20bce8cbcf0d5ae44e34eaf.patch"; + sha256 = "sha256-pRkG77sNglG/KsRX6JaPgk4QxmmSBXypFRp/vNA3ot4="; + }) + ]; + disabledTests = [ + # https://github.com/requests/toolbelt/issues/306 "test_no_content_length_header" "test_read_file" "test_reads_file_from_url_wrapper" @@ -41,10 +52,10 @@ buildPythonPackage rec { "requests_toolbelt" ]; - meta = { + meta = with lib; { description = "Toolbelt of useful classes and functions to be used with requests"; homepage = "http://toolbelt.rtfd.org"; - license = lib.licenses.asl20; - maintainers = with lib.maintainers; [ matthiasbeyer ]; + license = licenses.asl20; + maintainers = with maintainers; [ matthiasbeyer ]; }; }