summary refs log tree commit diff
path: root/pkgs/development/python-modules/django-redis/default.nix
blob: 11033b3e0f1e7d596bc9989825e400d10cbff46f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
{ lib
, fetchFromGitHub
, pythonOlder
, buildPythonPackage

# propagated
, django
, hiredis
, lz4
, msgpack
, redis

# testing
, pkgs
, pytest-django
, pytest-mock
, pytestCheckHook
}:

let
  pname = "django-redis";
  version = "5.2.0";
in
buildPythonPackage {
  inherit pname version;
  format = "setuptools";
  disabled = pythonOlder "3.6";

  src = fetchFromGitHub {
    owner = "jazzband";
    repo = "django-redis";
    rev = version;
    sha256 = "sha256-e8wCgfxBT+WKFY4H83CTMirTpQym3QAoeWnXbRCDO90=";
  };

  postPatch = ''
    sed -i '/-cov/d' setup.cfg
  '';

  propagatedBuildInputs = [
    django
    hiredis
    lz4
    msgpack
    redis
  ];

  pythonImportsCheck = [
    "django_redis"
  ];

  DJANGO_SETTINGS_MODULE = "tests.settings.sqlite";

  preCheck = ''
    ${pkgs.redis}/bin/redis-server &
    REDIS_PID=$!
  '';

  postCheck = ''
    kill $REDIS_PID
  '';

  nativeCheckInputs = [
    pytest-django
    pytest-mock
    pytestCheckHook
  ];

  disabledTests = [
    # ModuleNotFoundError: No module named 'test_cache_options'
    "test_custom_key_function"
    # ModuleNotFoundError: No module named 'test_client'
    "test_delete_pattern_calls_get_client_given_no_client"
    "test_delete_pattern_calls_make_pattern"
    "test_delete_pattern_calls_scan_iter_with_count_if_itersize_given"
    "test_delete_pattern_calls_scan_iter_with_count_if_itersize_given"
    "test_delete_pattern_calls_scan_iter"
    "test_delete_pattern_calls_delete_for_given_keys"
  ];

  meta = with lib; {
    description = "Full featured redis cache backend for Django";
    homepage = "https://github.com/jazzband/django-redis";
    license = licenses.bsd3;
    maintainers = with maintainers; [ hexa ];
  };
}