1{ lib
2, stdenv
3, buildPythonPackage
4, fetchPypi
5, pythonOlder
6, aiodns
7, aiohttp
8, flask
9, mock
10, pytest
11, pytest-asyncio
12, pytest-trio
13, pytestCheckHook
14, requests
15, six
16, trio
17, typing-extensions
18}:
19
20buildPythonPackage rec {
21 version = "1.28.0";
22 pname = "azure-core";
23 format = "setuptools";
24
25 disabled = pythonOlder "3.7";
26
27 __darwinAllowLocalNetworking = true;
28
29 src = fetchPypi {
30 inherit pname version;
31 extension = "zip";
32 hash = "sha256-6e78Zvwf3lbatvBNTl0SxgdU1an6Sb3P2FNPyW7ZNr0=";
33 };
34
35 propagatedBuildInputs = [
36 requests
37 six
38 typing-extensions
39 ];
40
41 passthru.optional-dependencies = {
42 aio = [
43 aiohttp
44 ];
45 };
46
47 nativeCheckInputs = [
48 aiodns
49 flask
50 mock
51 pytest
52 pytest-trio
53 pytest-asyncio
54 pytestCheckHook
55 trio
56 ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies);
57
58 # test server needs to be available
59 preCheck = ''
60 export PYTHONPATH=tests/testserver_tests/coretestserver:$PYTHONPATH
61 '';
62
63 pytestFlagsArray = [
64 "tests/"
65 ];
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.isDarwin [
80 "location_polling_fail"
81 ];
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";
103 changelog = "https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/CHANGELOG.md";
104 license = licenses.mit;
105 maintainers = with maintainers; [ jonringer ];
106 };
107}