summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/redshift-connector/default.nix
blob: e12f9a86cef52e69719218cc4ce8d533db58f343 (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
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,

  # build-system
  setuptools,

  # dependencies
  beautifulsoup4,
  boto3,
  botocore,
  lxml,
  packaging,
  pytz,
  requests,
  scramp,

  # test
  pytest-mock,
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "redshift-connector";
  version = "2.1.10";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "aws";
    repo = "amazon-redshift-python-driver";
    tag = "v${version}";
    hash = "sha256-k4Itd+x+1NbDsot2feunMKQVZA7ngAE4Bvy6+07gdaY=";
  };

  # remove addops as they add test directory and coverage parameters to pytest
  postPatch = ''
    substituteInPlace setup.cfg --replace 'addopts =' 'no-opts ='
  '';

  build-system = [ setuptools ];

  dependencies = [
    beautifulsoup4
    boto3
    botocore
    lxml
    packaging
    pytz
    requests
    scramp
  ];

  pythonRelaxDeps = [ "lxml" ];

  nativeCheckInputs = [
    pytest-mock
    pytestCheckHook
  ];

  # integration tests require a Redshift cluster
  enabledTestPaths = [ "test/unit" ];

  disabledTests = [
    # AttributeError: 'itertools._tee' object has no attribute 'status_code'
    # This is due to a broken pytest_mock.
    # TODO Remove once pytest-mock 3.15.1 lands.
    "test_form_based_authentication_uses_user_set_login_to_rp"
    "test_form_based_authentication_payload_is_correct"
    "test_form_based_authentication_login_fails_should_fail"
    "test_azure_oauth_based_authentication_payload_is_correct"
    "test_okta_authentication_payload_is_correct"
    "test_set_cluster_identifier_calls_describe_custom_domain_associations"
  ];

  __darwinAllowLocalNetworking = true; # required for tests

  meta = {
    description = "Redshift interface library";
    homepage = "https://github.com/aws/amazon-redshift-python-driver";
    changelog = "https://github.com/aws/amazon-redshift-python-driver/releases/tag/${src.tag}";
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [ mcwitt ];
  };
}