nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib, stdenv, buildPythonPackage, fetchpatch, fetchPypi, pythonOlder
2, aiodns
3, aiohttp
4, flask
5, mock
6, msrest
7, pytest
8, pytest-asyncio
9, pytest-trio
10, pytestCheckHook
11, requests
12, six
13, trio
14, typing-extensions
15}:
16
17buildPythonPackage rec {
18 version = "1.24.0";
19 pname = "azure-core";
20 disabled = pythonOlder "3.6";
21
22 src = fetchPypi {
23 inherit pname version;
24 extension = "zip";
25 sha256 = "sha256-NFsbBB+q19AgWyDVaX8dDfNEMC56qoUBkFWA/4e9C+U=";
26 };
27
28 patches = [
29 # FIXME: fixes tests with new versions of flask/werkzeug
30 # upstream PR: https://github.com/Azure/azure-sdk-for-python/pull/24450
31 (fetchpatch {
32 url = "https://github.com/Azure/azure-sdk-for-python/commit/fb20b0b985f614bb7bcd84f3f5f6f3105de25fd9.patch";
33 stripLen = 3;
34 sha256 = "sha256-Gt5T/UkQT1yml8bqYbeUpimfOPlmzpN1KKKUnbU9xJw=";
35 })
36 ];
37
38 propagatedBuildInputs = [
39 requests
40 six
41 typing-extensions
42 ];
43
44 checkInputs = [
45 aiodns
46 aiohttp
47 flask
48 mock
49 msrest
50 pytest
51 pytest-trio
52 pytest-asyncio
53 pytestCheckHook
54 trio
55 ];
56
57 # test server needs to be available
58 preCheck = ''
59 export PYTHONPATH=tests/testserver_tests/coretestserver:$PYTHONPATH
60 '';
61
62 pytestFlagsArray = [ "tests/" ];
63 # disable tests which touch network
64 disabledTests = [
65 "aiohttp"
66 "multipart_send"
67 "response"
68 "request"
69 "timeout"
70 "test_sync_transport_short_read_download_stream"
71 "test_aio_transport_short_read_download_stream"
72 # disable 8 tests failing on some darwin machines with errors:
73 # azure.core.polling.base_polling.BadStatus: Invalid return status 403 for 'GET' operation
74 # azure.core.exceptions.HttpResponseError: Operation returned an invalid status 'Forbidden'
75 ] ++ lib.optional stdenv.isDarwin [
76 "location_polling_fail"
77 ];
78 disabledTestPaths = [
79 # requires testing modules which aren't published, and likely to create cyclic dependencies
80 "tests/test_connection_string_parsing.py"
81 # wants network
82 "tests/async_tests/test_streaming_async.py"
83 "tests/test_streaming.py"
84 # testserver tests require being in a very specific working directory to make it work
85 "tests/testserver_tests/"
86 ];
87
88 meta = with lib; {
89 description = "Microsoft Azure Core Library for Python";
90 homepage = "https://github.com/Azure/azure-sdk-for-python";
91 license = licenses.mit;
92 maintainers = with maintainers; [ jonringer ];
93 };
94}