nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 hypothesis,
6 jsonpath-ng,
7 lupa,
8 hatchling,
9 pyprobables,
10 pytest-asyncio,
11 pytest-mock,
12 pytestCheckHook,
13 redis,
14 redisTestHook,
15 sortedcontainers,
16 valkey,
17}:
18
19buildPythonPackage rec {
20 pname = "fakeredis";
21 version = "2.33.0";
22 pyproject = true;
23
24 src = fetchFromGitHub {
25 owner = "dsoftwareinc";
26 repo = "fakeredis-py";
27 tag = "v${version}";
28 hash = "sha256-uvbvrziVdoa/ip8MbZG8GcpN1FoINxUV+SDVRmg78Qs=";
29 };
30
31 build-system = [ hatchling ];
32
33 dependencies = [
34 redis
35 sortedcontainers
36 ];
37
38 optional-dependencies = {
39 lua = [ lupa ];
40 json = [ jsonpath-ng ];
41 bf = [ pyprobables ];
42 cf = [ pyprobables ];
43 probabilistic = [ pyprobables ];
44 valkey = [ valkey ];
45 };
46
47 nativeCheckInputs = [
48 hypothesis
49 pytest-asyncio
50 pytest-mock
51 pytestCheckHook
52 redisTestHook
53 valkey
54 ];
55
56 pythonImportsCheck = [ "fakeredis" ];
57
58 disabledTestMarks = [ "slow" ];
59
60 disabledTests = [
61 "test_init_args" # AttributeError: module 'fakeredis' has no attribute 'FakeValkey'
62 "test_async_init_kwargs" # AttributeError: module 'fakeredis' has no attribute 'FakeAsyncValkey'"
63
64 # redis.exceptions.ResponseError: unknown command 'evalsha'
65 "test_async_lock"
66
67 # AssertionError: assert [0, b'1'] == [0, 1.0]
68 "test_zrank_redis7_2"
69 "test_zrevrank_redis7_2"
70
71 # KeyError: 'tot-mem'
72 "test_acl_log_auth_exist"
73 "test_acl_log_invalid_channel"
74 "test_acl_log_invalid_key"
75 "test_client_id"
76 "test_client_info"
77 "test_client_list"
78 ];
79
80 preCheck = ''
81 redisTestPort=6390
82 '';
83
84 meta = {
85 description = "Fake implementation of Redis API";
86 homepage = "https://github.com/dsoftwareinc/fakeredis-py";
87 changelog = "https://github.com/cunla/fakeredis-py/releases/tag/${src.tag}";
88 license = with lib.licenses; [ bsd3 ];
89 maintainers = with lib.maintainers; [ fab ];
90 };
91}