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 = [
42 aiohttp
43 webtest
44 ];
45
46 nativeCheckInputs = [
47 pytest-aiohttp
48 pytestCheckHook
49 ];
50
51 pythonImportsCheck = [ "webtest_aiohttp" ];
52
53 meta = with lib; {
54 changelog = "https://github.com/sloria/webtest-aiohttp/blob/${src.rev}/CHANGELOG.rst";
55 description = "Provides integration of WebTest with aiohttp.web applications";
56 homepage = "https://github.com/sloria/webtest-aiohttp";
57 license = licenses.mit;
58 maintainers = with maintainers; [ cript0nauta ];
59 };
60}