summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/django-q2/default.nix
blob: b878b464cc80c4900d64c415d02e2dae9a86ca73 (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
87
88
89
90
91
92
93
94
95
{
  lib,
  arrow,
  blessed,
  bson,
  buildPythonPackage,
  croniter,
  django,
  django-picklefield,
  django-redis,
  fetchFromGitHub,
  hiredis,
  poetry-core,
  pytest-django,
  pytestCheckHook,
  redisTestHook,
  stdenv,
}:

buildPythonPackage rec {
  pname = "django-q2";
  version = "1.8.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "django-q2";
    repo = "django-q2";
    tag = "v${version}";
    hash = "sha256-SmTiplQzmMiK6xBs1TDikHE1ChI2twqemaP/ID6kvc4=";
  };

  postPatch = ''
    substituteInPlace django_q/tests/settings.py \
      --replace-fail "HiredisParser" "_HiredisParser"
  '';

  build-system = [
    poetry-core
  ];

  dependencies = [
    arrow
    bson # required for mongodb but undocumented
    django
    django-picklefield
  ];

  nativeCheckInputs = [
    blessed
    croniter
    django-redis
    hiredis
    pytest-django
    pytestCheckHook
    redisTestHook
  ];

  pythonImportsCheck = [ "django_q" ];

  env = {
    MONGO_HOST = "127.0.0.1";
    REDIS_HOST = "127.0.0.1";
  };

  disabledTests = [
    # requires a running mongodb
    "test_mongo"
  ]
  ++ lib.optionals stdenv.hostPlatform.isDarwin [
    # fails with an assertion
    "test_max_rss"
    "test_recycle"
    # cannot connect to redis
    "test_broker"
    "test_custom"
    "test_redis"
    "test_redis_connection"
  ];

  disabledTestPaths = [
    "django_q/tests/test_commands.py"
  ];

  pytestFlags = [ "-vv" ];

  __darwinAllowLocalNetworking = true;

  meta = {
    description = "Multiprocessing distributed task queue for Django based on Django-Q";
    homepage = "https://github.com/django-q2/django-q2";
    changelog = "https://github.com/django-q2/django-q2/releases/tag/v${version}";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ SuperSandro2000 ];
  };
}