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
```
2021-04-22 13:22:56 +02:00
|
|
|
{ lib
|
2021-04-23 15:50:34 +02:00
|
|
|
, stdenv
|
2021-02-13 18:28:30 +01:00
|
|
|
, buildPythonPackage
|
2021-02-13 18:45:46 +01:00
|
|
|
, fetchFromGitHub
|
2021-07-01 08:07:05 +02:00
|
|
|
, fetchpatch
|
2021-02-13 18:45:46 +01:00
|
|
|
, isPy27
|
|
|
|
, mock
|
2021-02-13 18:28:30 +01:00
|
|
|
, pyparsing
|
2021-02-13 18:45:46 +01:00
|
|
|
, pytest-forked
|
|
|
|
, pytest-randomly
|
|
|
|
, pytest-timeout
|
|
|
|
, pytest-xdist
|
|
|
|
, pytestCheckHook
|
|
|
|
, six
|
2021-02-13 18:28:30 +01:00
|
|
|
}:
|
2018-05-01 13:24:41 +02:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "httplib2";
|
2021-04-11 10:20:34 +02:00
|
|
|
version = "0.19.1";
|
2018-05-01 13:24:41 +02:00
|
|
|
|
2021-02-13 18:45:46 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = pname;
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2021-04-11 10:20:34 +02:00
|
|
|
sha256 = "sha256-e0Mq9AVJEWQ9GEtYFXk2fMIs7GtAUsyJN6XheqAnD3I=";
|
2018-05-01 13:24:41 +02:00
|
|
|
};
|
|
|
|
|
2021-07-01 08:07:05 +02:00
|
|
|
patches = [
|
|
|
|
# fix test_inject_space
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/httplib2/httplib2/commit/08d6993b69256fbc6c0b1c615c24910803c4d610.patch";
|
|
|
|
sha256 = "0kbd1skn58m20kfkh4qzd66g9bvj31xlkbhsg435dkk4qz6l3yn3";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2021-02-13 18:45:46 +01:00
|
|
|
postPatch = ''
|
|
|
|
sed -i "/--cov/d" setup.cfg
|
|
|
|
'';
|
|
|
|
|
2021-02-13 18:28:30 +01:00
|
|
|
propagatedBuildInputs = [ pyparsing ];
|
|
|
|
|
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
```
2021-04-22 13:22:56 +02:00
|
|
|
pythonImportsCheck = [ "httplib2" ];
|
|
|
|
|
|
|
|
# Don't run tests for Python 2.7
|
|
|
|
doCheck = !isPy27;
|
|
|
|
|
2021-02-13 18:45:46 +01:00
|
|
|
checkInputs = [
|
|
|
|
mock
|
|
|
|
pytest-forked
|
|
|
|
pytest-randomly
|
|
|
|
pytest-timeout
|
|
|
|
pytest-xdist
|
|
|
|
six
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
|
|
|
|
2021-04-23 15:50:34 +02:00
|
|
|
disabledTests = lib.optionals (stdenv.isDarwin) [
|
|
|
|
# fails with HTTP 408 Request Timeout, instead of expected 200 OK
|
|
|
|
"test_timeout_subsequent"
|
|
|
|
];
|
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
```
2021-04-22 13:22:56 +02:00
|
|
|
|
2021-04-23 15:50:34 +02:00
|
|
|
pytestFlagsArray = [ "--ignore python2" ];
|
2019-02-14 08:37:17 +01:00
|
|
|
|
2018-05-01 13:24:41 +02:00
|
|
|
meta = with lib; {
|
|
|
|
description = "A comprehensive HTTP client library";
|
2021-02-13 18:45:46 +01:00
|
|
|
homepage = "https://httplib2.readthedocs.io";
|
2018-05-01 13:24:41 +02:00
|
|
|
license = licenses.mit;
|
2021-02-13 18:45:46 +01:00
|
|
|
maintainers = with maintainers; [ fab ];
|
2018-05-01 13:24:41 +02:00
|
|
|
};
|
|
|
|
}
|