summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/django-tasks/default.nix
blob: 415108364e3d9fa8dd013c0c51afce5f328d105e (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
{
  lib,
  stdenv,
  buildPythonPackage,
  fetchFromGitHub,
  setuptools,
  django,
  django-stubs-ext,
  typing-extensions,
  mysqlclient,
  psycopg,
  dj-database-url,
  django-rq,
  fakeredis,
  pytestCheckHook,
  pytest-django,
  redisTestHook,
}:

buildPythonPackage rec {
  pname = "django-tasks";
  version = "0.8.1";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "RealOrangeOne";
    repo = "django-tasks";
    tag = version;
    hash = "sha256-fXXqPmpyIq+66okWDmTIBaoaslY8BSILXjJWn8cXnMM=";
  };

  build-system = [
    setuptools
  ];

  dependencies = [
    django
    django-stubs-ext
    typing-extensions
  ];

  optional-dependencies = {
    mysql = [
      mysqlclient
    ];
    postgres = [
      psycopg
    ];
  };

  pythonImportsCheck = [ "django_tasks" ];

  # redis hook does not support darwin
  doCheck = !stdenv.hostPlatform.isDarwin;

  nativeCheckInputs = [
    django-rq
    dj-database-url
    fakeredis
    pytestCheckHook
    pytest-django
    redisTestHook
  ];

  disabledTests = [
    # AssertionError: Lists differ: [] != ['Starting worker for queues=default', ...
    "test_verbose_logging"
    # AssertionError: '' != 'Deleted 0 task result(s)'
    "test_doesnt_prune_new_task"
    # AssertionError: '' != 'Would delete 1 task result(s)'
    "test_dry_run"
    # AssertionError: '' != 'Deleted 1 task result(s)'
    "test_prunes_tasks"
    # AssertionError: 'Run maximum tasks (2)' not found in ''
    "test_max_tasks"
  ];

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

  meta = {
    description = "Reference implementation and backport of background workers and tasks in Django";
    homepage = "https://github.com/RealOrangeOne/django-tasks";
    changelog = "https://github.com/RealOrangeOne/django-tasks/releases/tag/${src.tag}";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [ GaetanLepage ];
  };
}