summary refs log tree commit diff
path: root/pkgs/development/python-modules/sqlbag/default.nix
blob: 8b21d89ad5da5abf90097b1158105f9fb729a1a4 (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
88
89
90
91
92
93
94
95
{ lib
, buildPythonPackage
, fetchFromGitHub
, isPy27
, psycopg2
, pymysql
, sqlalchemy
, pathlib
, six
, flask
, pendulum
, packaging
, setuptools
, poetry-core
, pytestCheckHook
, pytest-xdist
, pytest-sugar
, postgresql
, postgresqlTestHook
,
}:
buildPythonPackage rec {
  pname = "sqlbag";
  version = "0.1.1617247075";
  format = "pyproject";

  src = fetchFromGitHub {
    owner = "djrobstep";
    repo = pname;
    # no tags on github, version patch number is unix time.
    rev = "eaaeec4158ffa139fba1ec30d7887f4d836f4120";
    hash = "sha256-lipgnkqrzjzqwbhtVcWDQypBNzq6Dct/qoM8y/FNiNs=";
  };

  nativeBuildInputs = [
    poetry-core
  ];

  propagatedBuildInputs =
    [
      sqlalchemy
      six
      packaging

      psycopg2
      pymysql

      setuptools # needed for 'pkg_resources'
    ]
    ++ lib.optional isPy27 pathlib;

  nativeCheckInputs = [
    pytestCheckHook
    pytest-xdist
    pytest-sugar

    postgresql
    postgresqlTestHook

    flask
    pendulum
  ];

  preCheck = ''
    export PGUSER="nixbld";
  '';
  disabledTests = [
    # These all fail with "List argument must consist only of tuples or dictionaries":
    # Related issue: https://github.com/djrobstep/sqlbag/issues/14
    "test_basic"
    "test_createdrop"
    "test_errors_and_messages"
    "test_flask_integration"
    "test_orm_stuff"
    "test_pendulum_for_time_types"
    "test_transaction_separation"
  ];

  pytestFlagsArray = [
    "-x"
    "-svv"
    "tests"
  ];

  pythonImportsCheck = [
    "sqlbag"
  ];

  meta = with lib; {
    description = "Handy python code for doing database things";
    homepage = "https://github.com/djrobstep/sqlbag";
    license = with licenses; [ unlicense ];
    maintainers = with maintainers; [ soispha ];
  };
}