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