summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/python-glanceclient/default.nix
blob: 4ccad99c4783e3b712ae2a07e50021273e30f8e1 (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
96
97
{
  lib,
  buildPythonPackage,
  fetchPypi,
  coreutils,
  setuptools,
  pbr,
  prettytable,
  keystoneauth1,
  requests,
  warlock,
  oslo-utils,
  oslo-i18n,
  wrapt,
  pyopenssl,
  stestr,
  testscenarios,
  ddt,
  requests-mock,
  writeText,
}:
let
  pname = "python-glanceclient";
  version = "4.10.0";

  disabledTests = [
    # Skip tests which require networking.
    "test_http_chunked_response"
    "test_v1_download_has_no_stray_output_to_stdout"
    "test_v2_requests_valid_cert_verification"
    "test_download_has_no_stray_output_to_stdout"
    "test_v1_requests_cert_verification_no_compression"
    "test_v1_requests_cert_verification"
    "test_v2_download_has_no_stray_output_to_stdout"
    "test_v2_requests_bad_ca"
    "test_v2_requests_bad_cert"
    "test_v2_requests_cert_verification_no_compression"
    "test_v2_requests_cert_verification"
    "test_v2_requests_valid_cert_no_key"
    "test_v2_requests_valid_cert_verification_no_compression"
    "test_log_request_id_once"
    # asserts exact amount of mock calls
    "test_cache_schemas_gets_when_forced"
    "test_cache_schemas_gets_when_not_exists"
  ];
in
buildPythonPackage {
  inherit pname version;
  pyproject = true;

  src = fetchPypi {
    pname = "python_glanceclient";
    inherit version;
    hash = "sha256-/2wtQqF2fFz6PNHSKjcy04qxE9RxrSLE7mShvTlBsQM=";
  };

  postPatch = ''
    substituteInPlace glanceclient/tests/unit/v1/test_shell.py \
      --replace-fail "/bin/echo" "${lib.getExe' coreutils "echo"}"
  '';

  nativeBuildInputs = [ setuptools ];

  propagatedBuildInputs = [
    pbr
    prettytable
    keystoneauth1
    requests
    warlock
    oslo-utils
    oslo-i18n
    wrapt
    pyopenssl
  ];

  nativeCheckInputs = [
    stestr
    testscenarios
    ddt
    requests-mock
  ];

  checkPhase = ''
    runHook preCheck
    stestr run -e ${writeText "disabled-tests" (lib.concatStringsSep "\n" disabledTests)}
    runHook postCheck
  '';

  pythonImportsCheck = [ "glanceclient" ];

  meta = {
    description = "Python bindings for the OpenStack Images API";
    homepage = "https://github.com/openstack/python-glanceclient/";
    license = lib.licenses.asl20;
    teams = [ lib.teams.openstack ];
  };
}