about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/aiohttp/default.nix
blob: c0722c8c9781fea6c9e979589a9402ecbb4ba826 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
{ lib
, stdenv
, buildPythonPackage
, fetchPypi
, pythonOlder
, async-timeout
, attrs
, chardet
, idna-ssl
, multidict
, typing-extensions
, yarl
, async_generator
, brotlipy
, freezegun
, gunicorn
, pytest-mock
, pytest-xdist
, pytestCheckHook
, re-assert
, trustme
}:

buildPythonPackage rec {
  pname = "aiohttp";
  version = "3.7.4.post0";
  disabled = pythonOlder "3.6";

  src = fetchPypi {
    inherit pname version;
    sha256 = "493d3299ebe5f5a7c66b9819eacdcfbbaaf1a8e84911ddffcdc48888497afecf";
  };

  postPatch = ''
    substituteInPlace setup.cfg --replace " --cov=aiohttp" ""
  '';

  propagatedBuildInputs = [
    async-timeout
    attrs
    chardet
    multidict
    typing-extensions
    yarl
  ] ++ lib.optionals (pythonOlder "3.7") [
    idna-ssl
  ];

  checkInputs = [
    async_generator
    brotlipy
    freezegun
    gunicorn
    pytest-mock
    pytest-xdist
    pytestCheckHook
    re-assert
    trustme
  ];

  pytestFlagsArray = [
    "-n auto"
  ];

  disabledTests = [
    # Disable tests that require network access
    "test_mark_formdata_as_processed"
  ] ++ lib.optionals stdenv.is32bit [
    "test_cookiejar"
  ] ++ lib.optionals stdenv.isDarwin [
    "test_addresses"  # https://github.com/aio-libs/aiohttp/issues/3572, remove >= v4.0.0
    "test_close"
  ];

  __darwinAllowLocalNetworking = true;

  # aiohttp in current folder shadows installed version
  # Probably because we run `python -m pytest` instead of `pytest` in the hook.
  preCheck = ''
    cd tests
  '';

  meta = with lib; {
    description = "Asynchronous HTTP Client/Server for Python and asyncio";
    license = licenses.asl20;
    homepage = "https://github.com/aio-libs/aiohttp";
    maintainers = with maintainers; [ dotlambda ];
  };
}