From f185a7b84337dec22ce218e9917540572d30df25 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Thu, 22 Apr 2021 13:22:56 +0200 Subject: [PATCH] python3Packages.httplib2: allow local networking on darwin There is just one test failure on darwin, and it can probably be worked around by allowing local networking. This should hopefully fix the following testsuite error: ``` ___________________________ test_timeout_subsequent ____________________________ tests/test_other.py:137: in test_timeout_subsequent assert response.status == 200 E assert 408 == 200 E +408 E -200 Handler = .Handler'> _ = b'Request Timeout' http = response = {'content-type': 'text/plain', 'status': '408', 'content-length': 15} uri = 'http://localhost:58287/' ----------------------------- Captured stderr call ----------------------------- Traceback (most recent call last): File "/private/tmp/nix-build-python3.8-httplib2-0.19.1.drv-0/source/tests/__init__.py", line 311, in server_socket_thread fun(client, tick) File "/private/tmp/nix-build-python3.8-httplib2-0.19.1.drv-0/source/tests/__init__.py", line 392, in server_request_socket_handler request = HttpRequest.from_buffered(buf) File "/private/tmp/nix-build-python3.8-httplib2-0.19.1.drv-0/source/tests/__init__.py", line 177, in from_buffered return parse_http_message(cls, buf) File "/private/tmp/nix-build-python3.8-httplib2-0.19.1.drv-0/source/tests/__init__.py", line 120, in parse_http_message start_line = buf.readline() File "/private/tmp/nix-build-python3.8-httplib2-0.19.1.drv-0/source/tests/__init__.py", line 110, in readline self._fill(more=1) File "/private/tmp/nix-build-python3.8-httplib2-0.19.1.drv-0/source/tests/__init__.py", line 81, in _fill chunk = self._sock.recv(8 << 10) ConnectionResetError: [Errno 54] Connection reset by peer ``` --- .../python-modules/httplib2/default.nix | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pkgs/development/python-modules/httplib2/default.nix b/pkgs/development/python-modules/httplib2/default.nix index 39bfdbfe7b2..40cd705f090 100644 --- a/pkgs/development/python-modules/httplib2/default.nix +++ b/pkgs/development/python-modules/httplib2/default.nix @@ -1,5 +1,4 @@ -{ stdenv -, lib +{ lib , buildPythonPackage , fetchFromGitHub , isPy27 @@ -30,6 +29,11 @@ buildPythonPackage rec { propagatedBuildInputs = [ pyparsing ]; + pythonImportsCheck = [ "httplib2" ]; + + # Don't run tests for Python 2.7 + doCheck = !isPy27; + checkInputs = [ mock pytest-forked @@ -40,12 +44,9 @@ buildPythonPackage rec { pytestCheckHook ]; - # Don't run tests for Python 2.7 or Darwin - # Nearly 50% of the test suite requires local network access - # which isn't allowed on sandboxed Darwin builds - doCheck = !(isPy27 || stdenv.isDarwin); pytestFlagsArray = [ "--ignore python2" ]; - pythonImportsCheck = [ "httplib2" ]; + + __darwinAllowLocalNetworking = true; meta = with lib; { description = "A comprehensive HTTP client library";