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 ] ++ lib.flatten (builtins.attrValues optional-dependencies);
59
60 # test server needs to be available
61 preCheck = ''
62 export PYTHONPATH=tests/testserver_tests/coretestserver:$PYTHONPATH
63 '';
64
65 pytestFlagsArray = [ "tests/" ];
66
67 # disable tests which touch network
68 disabledTests = [
69 "aiohttp"
70 "multipart_send"
71 "response"
72 "request"
73 "timeout"
74 "test_sync_transport_short_read_download_stream"
75 "test_aio_transport_short_read_download_stream"
76 # disable 8 tests failing on some darwin machines with errors:
77 # azure.core.polling.base_polling.BadStatus: Invalid return status 403 for 'GET' operation
78 # azure.core.exceptions.HttpResponseError: Operation returned an invalid status 'Forbidden'
79 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ "location_polling_fail" ];
80
81 disabledTestPaths = [
82 # requires testing modules which aren't published, and likely to create cyclic dependencies
83 "tests/test_connection_string_parsing.py"
84 # wants network
85 "tests/async_tests/test_streaming_async.py"
86 "tests/test_streaming.py"
87 # testserver tests require being in a very specific working directory to make it work
88 "tests/testserver_tests/"
89 # requires missing pytest plugin
90 "tests/async_tests/test_rest_asyncio_transport.py"
91 # needs msrest, which cannot be included in nativeCheckInputs due to circular dependency new in msrest 0.7.1
92 # azure-core needs msrest which needs azure-core
93 "tests/test_polling.py"
94 "tests/async_tests/test_base_polling_async.py"
95 "tests/async_tests/test_polling_async.py"
96 ];
97
98 meta = with lib; {
99 description = "Microsoft Azure Core Library for Python";
100 homepage = "https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/core/azure-core";
101 changelog = "https://github.com/Azure/azure-sdk-for-python/blob/azure-core_${version}/sdk/core/azure-core/CHANGELOG.md";
102 license = licenses.mit;
103 maintainers = [ ];
104 };
105}