From 3853e60ae37119ffbcab21fd5dff285c747f9c18 Mon Sep 17 00:00:00 2001 From: Jonathan Ringer Date: Mon, 22 Jun 2020 15:43:09 -0700 Subject: [PATCH] python3Packages.cheroot: fix tests, cleanup expr --- .../python-modules/cheroot/default.nix | 53 ++++++++++++++----- 1 file changed, 40 insertions(+), 13 deletions(-) diff --git a/pkgs/development/python-modules/cheroot/default.nix b/pkgs/development/python-modules/cheroot/default.nix index 269e59b9c184..1ea6b87fa00a 100644 --- a/pkgs/development/python-modules/cheroot/default.nix +++ b/pkgs/development/python-modules/cheroot/default.nix @@ -1,10 +1,19 @@ -{ stdenv, fetchPypi, buildPythonPackage, pythonAtLeast, isPy3k -, more-itertools, six, setuptools_scm, setuptools-scm-git-archive -, pytest, pytestcov, portend, pytest-testmon, pytest-mock -, backports_unittest-mock, pyopenssl, requests, trustme, requests-unixsocket -, backports_functools_lru_cache }: - -let inherit (stdenv) lib; in +{ lib, stdenv, fetchPypi, buildPythonPackage, isPy3k +, jaraco_text +, more-itertools +, portend +, pyopenssl +, pytestCheckHook +, pytestcov +, pytest-mock +, pytest-testmon +, requests +, requests-unixsocket +, setuptools_scm +, setuptools-scm-git-archive +, six +, trustme +}: buildPythonPackage rec { pname = "cheroot"; @@ -19,21 +28,39 @@ buildPythonPackage rec { nativeBuildInputs = [ setuptools_scm setuptools-scm-git-archive ]; - propagatedBuildInputs = [ more-itertools six backports_functools_lru_cache ]; + propagatedBuildInputs = [ more-itertools six ]; - checkInputs = [ pytest pytestcov portend backports_unittest-mock pytest-mock pytest-testmon pyopenssl requests trustme requests-unixsocket ]; + checkInputs = [ + jaraco_text + portend + pyopenssl + pytestCheckHook + pytestcov + pytest-mock + pytest-testmon + requests + requests-unixsocket + trustme + ]; # Disable doctest plugin because times out # Disable xdist (-n arg) because it's incompatible with testmon # Deselect test_bind_addr_unix on darwin because times out # Deselect test_http_over_https_error on darwin because builtin cert fails # Disable warnings-as-errors because of deprecation warnings from socks on python 3.7 - checkPhase = '' - substituteInPlace pytest.ini --replace "--doctest-modules" "" --replace "-n auto" "" - ${lib.optionalString (pythonAtLeast "3.7") "sed -i '/warnings/,+2d' pytest.ini"} - pytest -k 'not tls' ${lib.optionalString stdenv.isDarwin "--deselect=cheroot/test/test_ssl.py::test_http_over_https_error --deselect=cheroot/test/test_server.py::test_bind_addr_unix"} + # adds many other pytest utilities which aren't necessary like linting + preCheck = '' + rm pytest.ini ''; + disabledTests= [ + "tls" # touches network + "peercreds_unix_sock" # test urls no longer allowed + ] ++ lib.optionals stdenv.isDarwin [ + "http_over_https_error" + "bind_addr_unix" + ]; + # Some of the tests use localhost networking. __darwinAllowLocalNetworking = true;