summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/webtest-aiohttp/default.nix
blob: f8dfdd4476c5b444cdf9eedb790be7f7e8a54226 (plain)
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
{
  lib,
  aiohttp,
  buildPythonPackage,
  fetchFromGitHub,
  fetchpatch,
  pytest-aiohttp,
  pytest-asyncio_0,
  pytestCheckHook,
  setuptools,
  webtest,
}:

buildPythonPackage rec {
  pname = "webtest-aiohttp";
  version = "2.0.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "sloria";
    repo = "webtest-aiohttp";
    tag = version;
    hash = "sha256-UuAz/k/Tnumupv3ybFR7PkYHwG3kH7M5oobZykEP+ao=";
  };

  patches = [
    (fetchpatch {
      name = "python311-compat.patch";
      url = "https://github.com/sloria/webtest-aiohttp/commit/64e5ab1867ea9ef87901bb2a1a6142566bffc90b.patch";
      hash = "sha256-OKJGajqJLFMkcbGmGfU9G5hCpJaj24Gs363sI0z7YZw=";
    })
  ];

  postPatch = ''
    substituteInPlace test_webtest_aiohttp.py \
      --replace-fail '(app, loop)' '(app, event_loop)' \
      --replace-fail 'WebTestApp(app, loop=loop)' 'WebTestApp(app, loop=event_loop)'
  '';

  build-system = [ setuptools ];

  dependencies = [
    aiohttp
    webtest
  ];

  nativeCheckInputs = [
    pytest-asyncio_0
    pytest-aiohttp
    pytestCheckHook
  ];

  pythonImportsCheck = [ "webtest_aiohttp" ];

  meta = {
    changelog = "https://github.com/sloria/webtest-aiohttp/blob/${src.rev}/CHANGELOG.rst";
    description = "Provides integration of WebTest with aiohttp.web applications";
    homepage = "https://github.com/sloria/webtest-aiohttp";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ cript0nauta ];
  };
}