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.2.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 = version;
34 hash = "sha256-e8wCgfxBT+WKFY4H83CTMirTpQym3QAoeWnXbRCDO90=";
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 pytestFlagsArray = lib.optionals (pythonAtLeast "3.11") [
71 # DeprecationWarning: 'cgi' is deprecated and slated for removal in Python 3.13
72 "-W" "ignore::DeprecationWarning"
73 ];
74
75 disabledTests = [
76 # ModuleNotFoundError: No module named 'test_cache_options'
77 "test_custom_key_function"
78 # ModuleNotFoundError: No module named 'test_client'
79 "test_delete_pattern_calls_get_client_given_no_client"
80 "test_delete_pattern_calls_make_pattern"
81 "test_delete_pattern_calls_scan_iter_with_count_if_itersize_given"
82 "test_delete_pattern_calls_scan_iter_with_count_if_itersize_given"
83 "test_delete_pattern_calls_scan_iter"
84 "test_delete_pattern_calls_delete_for_given_keys"
85 ];
86
87 meta = with lib; {
88 description = "Full featured redis cache backend for Django";
89 homepage = "https://github.com/jazzband/django-redis";
90 license = licenses.bsd3;
91 maintainers = with maintainers; [ hexa ];
92 };
93}