1{ lib
2, fetchFromGitHub
3, pythonAtLeast
4, pythonOlder
5, buildPythonPackage
6
7# propagated
8, django
9, hiredis
10, lz4
11, msgpack
12, redis
13
14# testing
15, pkgs
16, pytest-django
17, pytest-mock
18, pytestCheckHook
19}:
20
21let
22 pname = "django-redis";
23 version = "5.4.0";
24in
25buildPythonPackage {
26 inherit pname version;
27 format = "setuptools";
28 disabled = pythonOlder "3.6";
29
30 src = fetchFromGitHub {
31 owner = "jazzband";
32 repo = "django-redis";
33 rev = "refs/tags/${version}";
34 hash = "sha256-m7z3c7My24vrSSnyfDQ/LlWhy7pV4U0L8LATMvkfczc=";
35 };
36
37 postPatch = ''
38 sed -i '/-cov/d' setup.cfg
39 '';
40
41 propagatedBuildInputs = [
42 django
43 hiredis
44 lz4
45 msgpack
46 redis
47 ];
48
49 pythonImportsCheck = [
50 "django_redis"
51 ];
52
53 DJANGO_SETTINGS_MODULE = "tests.settings.sqlite";
54
55 preCheck = ''
56 ${pkgs.redis}/bin/redis-server &
57 REDIS_PID=$!
58 '';
59
60 postCheck = ''
61 kill $REDIS_PID
62 '';
63
64 nativeCheckInputs = [
65 pytest-django
66 pytest-mock
67 pytestCheckHook
68 ];
69
70 disabledTests = [
71 # ModuleNotFoundError: No module named 'test_cache_options'
72 "test_custom_key_function"
73 # ModuleNotFoundError: No module named 'test_client'
74 "test_delete_pattern_calls_delete_for_given_keys"
75 "test_delete_pattern_calls_get_client_given_no_client"
76 "test_delete_pattern_calls_make_pattern"
77 "test_delete_pattern_calls_pipeline_delete_and_execute"
78 "test_delete_pattern_calls_scan_iter"
79 "test_delete_pattern_calls_scan_iter_with_count_if_itersize_given"
80 ];
81
82 meta = with lib; {
83 description = "Full featured redis cache backend for Django";
84 homepage = "https://github.com/jazzband/django-redis";
85 changelog = "https://github.com/jazzband/django-redis/releases/tag/${version}";
86 license = licenses.bsd3;
87 maintainers = with maintainers; [ hexa ];
88 };
89}