1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchPypi,
6 pythonOlder,
7 aiodns,
8 aiohttp,
9 flask,
10 mock,
11 pytest,
12 pytest-asyncio,
13 pytest-trio,
14 pytestCheckHook,
15 requests,
16 setuptools,
17 six,
18 trio,
19 typing-extensions,
20}:
21
22buildPythonPackage rec {
23 version = "1.32.0";
24 pname = "azure-core";
25 pyproject = true;
26
27 disabled = pythonOlder "3.7";
28
29 __darwinAllowLocalNetworking = true;
30
31 src = fetchPypi {
32 pname = "azure_core";
33 inherit version;
34 hash = "sha256-IrPDXWstrhSZD2wb4pEr8j/+ULIg5wiiirG7krHHMOU=";
35 };
36
37 nativeBuildInputs = [ setuptools ];
38
39 propagatedBuildInputs = [
40 requests
41 six
42 typing-extensions
43 ];
44
45 optional-dependencies = {
46 aio = [ aiohttp ];
47 };
48
49 nativeCheckInputs = [
50 aiodns
51 flask
52 mock
53 pytest
54 pytest-trio
55 pytest-asyncio
56 pytestCheckHook
57 trio
58 ]
59 ++ lib.flatten (builtins.attrValues optional-dependencies);
60
61 # test server needs to be available
62 preCheck = ''
63 export PYTHONPATH=tests/testserver_tests/coretestserver:$PYTHONPATH
64 '';
65
66 enabledTestPaths = [ "tests/" ];
67
68 # disable tests which touch network
69 disabledTests = [
70 "aiohttp"
71 "multipart_send"
72 "response"
73 "request"
74 "timeout"
75 "test_sync_transport_short_read_download_stream"
76 "test_aio_transport_short_read_download_stream"
77 # disable 8 tests failing on some darwin machines with errors:
78 # azure.core.polling.base_polling.BadStatus: Invalid return status 403 for 'GET' operation
79 # azure.core.exceptions.HttpResponseError: Operation returned an invalid status 'Forbidden'
80 ]
81 ++ lib.optionals stdenv.hostPlatform.isDarwin [ "location_polling_fail" ];
82
83 disabledTestPaths = [
84 # requires testing modules which aren't published, and likely to create cyclic dependencies
85 "tests/test_connection_string_parsing.py"
86 # wants network
87 "tests/async_tests/test_streaming_async.py"
88 "tests/test_streaming.py"
89 # testserver tests require being in a very specific working directory to make it work
90 "tests/testserver_tests/"
91 # requires missing pytest plugin
92 "tests/async_tests/test_rest_asyncio_transport.py"
93 # needs msrest, which cannot be included in nativeCheckInputs due to circular dependency new in msrest 0.7.1
94 # azure-core needs msrest which needs azure-core
95 "tests/test_polling.py"
96 "tests/async_tests/test_base_polling_async.py"
97 "tests/async_tests/test_polling_async.py"
98 ];
99
100 meta = with lib; {
101 description = "Microsoft Azure Core Library for Python";
102 homepage = "https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/core/azure-core";
103 changelog = "https://github.com/Azure/azure-sdk-for-python/blob/azure-core_${version}/sdk/core/azure-core/CHANGELOG.md";
104 license = licenses.mit;
105 maintainers = [ ];
106 };
107}