summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/azure-core/default.nix
blob: 530b1ffe88cc035dc1160a39168e065f89f3aa10 (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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
{
  lib,
  stdenv,
  buildPythonPackage,
  fetchPypi,
  aiodns,
  aiohttp,
  flask,
  mock,
  opentelemetry-api,
  opentelemetry-instrumentation,
  opentelemetry-instrumentation-requests,
  opentelemetry-sdk,
  pytest,
  pytest-asyncio,
  pytest-trio,
  pytestCheckHook,
  requests,
  setuptools,
  six,
  trio,
  typing-extensions,
}:

buildPythonPackage rec {
  version = "1.35.0";
  pname = "azure-core";
  pyproject = true;

  __darwinAllowLocalNetworking = true;

  src = fetchPypi {
    pname = "azure_core";
    inherit version;
    hash = "sha256-wL5ShIlIXp7eWbaXHrY8HqrPg+9TABv+OQTkdelyvlw=";
  };

  build-system = [ setuptools ];

  dependencies = [
    requests
    six
    typing-extensions
  ];

  optional-dependencies = {
    aio = [ aiohttp ];
    tracing = [ opentelemetry-api ];
  };

  nativeCheckInputs = [
    aiodns
    flask
    mock
    opentelemetry-instrumentation
    opentelemetry-instrumentation-requests
    opentelemetry-sdk
    pytest
    pytest-trio
    pytest-asyncio
    pytestCheckHook
    trio
  ]
  ++ lib.concatAttrValues optional-dependencies;

  # test server needs to be available
  preCheck = ''
    export PYTHONPATH=tests/testserver_tests/coretestserver:$PYTHONPATH
  '';

  enabledTestPaths = [ "tests/" ];

  # disable tests which touch network
  disabledTests = [
    "aiohttp"
    "multipart_send"
    "response"
    "request"
    "timeout"
    "test_sync_transport_short_read_download_stream"
    "test_aio_transport_short_read_download_stream"
    # disable 8 tests failing on some darwin machines with errors:
    # azure.core.polling.base_polling.BadStatus: Invalid return status 403 for 'GET' operation
    # azure.core.exceptions.HttpResponseError: Operation returned an invalid status 'Forbidden'
  ]
  ++ lib.optionals stdenv.hostPlatform.isDarwin [ "location_polling_fail" ];

  disabledTestPaths = [
    # requires testing modules which aren't published, and likely to create cyclic dependencies
    "tests/test_connection_string_parsing.py"
    # wants network
    "tests/async_tests/test_streaming_async.py"
    "tests/test_streaming.py"
    # testserver tests require being in a very specific working directory to make it work
    "tests/testserver_tests/"
    # requires missing pytest plugin
    "tests/async_tests/test_rest_asyncio_transport.py"
    # needs msrest, which cannot be included in nativeCheckInputs due to circular dependency new in msrest 0.7.1
    # azure-core needs msrest which needs azure-core
    "tests/test_polling.py"
    "tests/async_tests/test_base_polling_async.py"
    "tests/async_tests/test_polling_async.py"
    # infinite recursion with azure-storage-blob
    "tests/async_tests/test_tracing_live_async.py"
    "tests/test_serialization.py"
    "tests/test_tracing_live.py"
  ];

  meta = {
    description = "Microsoft Azure Core Library for Python";
    homepage = "https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/core/azure-core";
    changelog = "https://github.com/Azure/azure-sdk-for-python/blob/azure-core_${version}/sdk/core/azure-core/CHANGELOG.md";
    license = lib.licenses.mit;
    maintainers = [ ];
  };
}