summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/django-redis/default.nix
blob: f5c544109669fa2ab15c32c4755b432dcea9809f (plain)
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
{
  lib,
  fetchFromGitHub,
  buildPythonPackage,
  setuptools,

  # propagated
  django,
  lz4,
  msgpack,
  pyzstd,
  redis,

  # testing
  pytest-cov-stub,
  pytest-django,
  pytest-mock,
  pytest-xdist,
  pytestCheckHook,
  redisTestHook,
}:

buildPythonPackage rec {
  pname = "django-redis";
  version = "6.0.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "jazzband";
    repo = "django-redis";
    tag = version;
    hash = "sha256-QfiyeeDQSRp/TkOun/HAQaPbIUY9yKPoOOEhKBX9Tec=";
  };

  build-system = [ setuptools ];

  dependencies = [
    django
    lz4
    msgpack
    pyzstd
    redis
  ];

  optional-dependencies = {
    hiredis = [ redis ] ++ redis.optional-dependencies.hiredis;
  };

  pythonImportsCheck = [ "django_redis" ];

  preCheck = ''
    export DJANGO_SETTINGS_MODULE=tests.settings.sqlite
  '';

  nativeCheckInputs = [
    pytest-cov-stub
    pytest-django
    pytest-mock
    pytest-xdist
    pytestCheckHook
    redisTestHook
  ]
  ++ lib.concatAttrValues optional-dependencies;

  # https://github.com/jazzband/django-redis/issues/777
  dontUsePytestXdist = true;

  pytestFlags = [
    "-Wignore::DeprecationWarning"
  ];

  disabledTests = [
    # AttributeError: <asgiref.local._CVar object at 0x7ffff57ed950> object has no attribute 'default'
    "test_delete_pattern_with_settings_default_scan_count"
  ];

  __darwinAllowLocalNetworking = true;

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