1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 hypothesis,
6 jsonpath-ng,
7 lupa,
8 poetry-core,
9 pyprobables,
10 pytest-asyncio,
11 pytest-mock,
12 pytestCheckHook,
13 pythonOlder,
14 redis,
15 redis-server,
16 sortedcontainers,
17}:
18
19buildPythonPackage rec {
20 pname = "fakeredis";
21 version = "2.26.1";
22 pyproject = true;
23
24 disabled = pythonOlder "3.7";
25
26 src = fetchFromGitHub {
27 owner = "dsoftwareinc";
28 repo = "fakeredis-py";
29 rev = "refs/tags/v${version}";
30 hash = "sha256-eBWdrN6QfrZaavKGuVMaU0s+k0VpsBCIaIzuxC7HyYE=";
31 };
32
33 build-system = [ poetry-core ];
34
35 dependencies = [
36 redis
37 sortedcontainers
38 ];
39
40 nativeCheckInputs = [
41 hypothesis
42 pytest-asyncio
43 pytest-mock
44 pytestCheckHook
45 ];
46
47 optional-dependencies = {
48 lua = [ lupa ];
49 json = [ jsonpath-ng ];
50 bf = [ pyprobables ];
51 cf = [ pyprobables ];
52 probabilistic = [ pyprobables ];
53 };
54
55 pythonImportsCheck = [ "fakeredis" ];
56
57 pytestFlagsArray = [ "-m 'not slow'" ];
58
59 preCheck = ''
60 ${lib.getExe' redis-server "redis-server"} --port 6390 &
61 REDIS_PID=$!
62 '';
63
64 postCheck = ''
65 kill $REDIS_PID
66 '';
67
68 disabledTests = [
69 # AssertionError
70 "test_command"
71 ];
72
73 meta = with lib; {
74 description = "Fake implementation of Redis API";
75 homepage = "https://github.com/dsoftwareinc/fakeredis-py";
76 changelog = "https://github.com/cunla/fakeredis-py/releases/tag/v${version}";
77 license = with licenses; [ bsd3 ];
78 maintainers = with maintainers; [ fab ];
79 };
80}