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