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    = <class 'tests.test_other.test_timeout_subsequent.<locals>.Handler'>
        _          = b'Request Timeout'
        http       = <httplib2.Http object at 0x10860f400>
        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
```
This commit is contained in:
Martin Weinelt 2021-04-22 13:22:56 +02:00
parent 8248f4db36
commit f185a7b843
No known key found for this signature in database
GPG Key ID: 87C1E9888F856759

View File

@ -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";