1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, pytestCheckHook
5, httpcore
6, httpx
7, pytest-asyncio
8, sanic
9, websockets
10}:
11
12buildPythonPackage rec {
13 pname = "sanic-testing";
14 version = "0.3.1";
15
16 src = fetchFromGitHub {
17 owner = "sanic-org";
18 repo = "sanic-testing";
19 rev = "v${version}";
20 hash = "sha256-hBAq+/BKs0a01M89Nb8HaClqxB+W5PTfjVzef/m9SWs=";
21 };
22
23 postPatch = ''
24 substituteInPlace setup.py \
25 --replace 'httpx>=0.16, <0.18' 'httpx' \
26 --replace 'httpcore==0.12.*' 'httpcore'
27 '';
28
29 propagatedBuildInputs = [ httpx sanic websockets httpcore ];
30
31 # `sanic` is explicitly set to null when building `sanic` itself
32 # to prevent infinite recursion. In that case we skip running
33 # the package at all.
34 doCheck = sanic != null;
35 dontUsePythonImportsCheck = sanic == null;
36
37 checkInputs = [ pytestCheckHook pytest-asyncio ];
38 pythonImportsCheck = [ "sanic_testing" ];
39
40 meta = with lib; {
41 description = "Core testing clients for the Sanic web framework";
42 homepage = "https://github.com/sanic-org/sanic-testing";
43 license = licenses.mit;
44 maintainers = with maintainers; [ AluisioASG ];
45 };
46}