1{ lib
2, stdenv
3, buildPythonPackage
4, cryptography
5, fetchFromGitHub
6, isPy27
7, mock
8, pyparsing
9, pytest-forked
10, pytest-randomly
11, pytest-timeout
12, pytestCheckHook
13, six
14}:
15
16buildPythonPackage rec {
17 pname = "httplib2";
18 version = "0.20.4";
19 format = "setuptools";
20
21 src = fetchFromGitHub {
22 owner = pname;
23 repo = pname;
24 rev = "v${version}";
25 sha256 = "sha256-eLvxmG9PUX+2RB3M6oG442Wmh6c5GI/aKP/Z8Z5Ixq8=";
26 };
27
28 propagatedBuildInputs = [
29 pyparsing
30 ];
31
32 checkInputs = [
33 cryptography
34 mock
35 pytest-forked
36 pytest-randomly
37 pytest-timeout
38 six
39 pytestCheckHook
40 ];
41
42 # Don't run tests for Python 2.7
43 doCheck = !isPy27;
44
45 postPatch = ''
46 sed -i "/--cov/d" setup.cfg
47 '';
48
49 disabledTests = [
50 # ValueError: Unable to load PEM file.
51 # https://github.com/httplib2/httplib2/issues/192#issuecomment-993165140
52 "test_client_cert_password_verified"
53
54 # improper pytest marking
55 "test_head_301"
56 "test_303"
57 ] ++ lib.optionals stdenv.isDarwin [
58 # fails with "ConnectionResetError: [Errno 54] Connection reset by peer"
59 "test_connection_close"
60 # fails with HTTP 408 Request Timeout, instead of expected 200 OK
61 "test_timeout_subsequent"
62 "test_connection_close"
63 ];
64
65 pytestFlagsArray = [
66 "--ignore python2"
67 ];
68
69 pythonImportsCheck = [
70 "httplib2"
71 ];
72
73 meta = with lib; {
74 description = "A comprehensive HTTP client library";
75 homepage = "https://github.com/httplib2/httplib2";
76 license = licenses.mit;
77 maintainers = with maintainers; [ fab ];
78 };
79}