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