1{
2 lib,
3 aiohttp,
4 buildPythonPackage,
5 fetchFromGitHub,
6 fetchpatch,
7 pytest-aiohttp,
8 pytest-asyncio_0,
9 pytestCheckHook,
10 setuptools,
11 webtest,
12}:
13
14buildPythonPackage rec {
15 pname = "webtest-aiohttp";
16 version = "2.0.0";
17 pyproject = true;
18
19 src = fetchFromGitHub {
20 owner = "sloria";
21 repo = "webtest-aiohttp";
22 tag = version;
23 hash = "sha256-UuAz/k/Tnumupv3ybFR7PkYHwG3kH7M5oobZykEP+ao=";
24 };
25
26 patches = [
27 (fetchpatch {
28 name = "python311-compat.patch";
29 url = "https://github.com/sloria/webtest-aiohttp/commit/64e5ab1867ea9ef87901bb2a1a6142566bffc90b.patch";
30 hash = "sha256-OKJGajqJLFMkcbGmGfU9G5hCpJaj24Gs363sI0z7YZw=";
31 })
32 ];
33
34 postPatch = ''
35 substituteInPlace test_webtest_aiohttp.py \
36 --replace-fail '(app, loop)' '(app, event_loop)' \
37 --replace-fail 'WebTestApp(app, loop=loop)' 'WebTestApp(app, loop=event_loop)'
38 '';
39
40 build-system = [ setuptools ];
41
42 dependencies = [
43 aiohttp
44 webtest
45 ];
46
47 nativeCheckInputs = [
48 pytest-asyncio_0
49 pytest-aiohttp
50 pytestCheckHook
51 ];
52
53 pythonImportsCheck = [ "webtest_aiohttp" ];
54
55 meta = with lib; {
56 changelog = "https://github.com/sloria/webtest-aiohttp/blob/${src.rev}/CHANGELOG.rst";
57 description = "Provides integration of WebTest with aiohttp.web applications";
58 homepage = "https://github.com/sloria/webtest-aiohttp";
59 license = licenses.mit;
60 maintainers = with maintainers; [ cript0nauta ];
61 };
62}