summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/python-etcd/default.nix
blob: def0b49aecaaf041c9dd3946266a0f51e0d50c61 (about) (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
{
  lib,
  stdenv,
  buildPythonPackage,
  fetchFromGitHub,
  setuptools,
  urllib3,
  dnspython,
  pytestCheckHook,
  etcd_3_4,
  mock,
  pyopenssl,
}:

buildPythonPackage {
  pname = "python-etcd";
  version = "0.5.0-unstable-2023-10-31";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "jplana";
    repo = "python-etcd";
    rev = "5aea0fd4461bd05dd96e4ad637f6be7bceb1cee5";
    hash = "sha256-eVirStLOPTbf860jfkNMWtGf+r0VygLZRjRDjBMCVKg=";
  };

  build-system = [ setuptools ];

  dependencies = [
    urllib3
    dnspython
  ];

  nativeCheckInputs = [
    pytestCheckHook
    etcd_3_4
    mock
    pyopenssl
  ];

  # arm64 is an unsupported platform on etcd 3.4. should be able to be removed on >= etcd 3.5
  doCheck = !stdenv.hostPlatform.isAarch64;

  preCheck = ''
    for file in "test_auth" "integration/test_simple"; do
      substituteInPlace src/etcd/tests/$file.py \
        --replace-fail "assertEquals" "assertEqual"
    done
  '';

  disabledTests = lib.optionals stdenv.hostPlatform.isDarwin [
    # Seems to be failing because of network restrictions
    # AttributeError: Can't get local object 'TestWatch.test_watch_indexed_generator.<locals>.watch_value'
    "test_watch"
    "test_watch_generator"
    "test_watch_indexed"
    "test_watch_indexed_generator"
  ];

  __darwinAllowLocalNetworking = true;

  meta = {
    description = "Python client for Etcd";
    homepage = "https://github.com/jplana/python-etcd";
    license = lib.licenses.mit;
  };
}