Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib
2, arangodb
3, buildPythonPackage
4, fetchFromGitHub
5, pythonOlder
6, pytestCheckHook
7, pyjwt
8, pytest
9, mock
10, requests
11, requests-toolbelt
12}:
13
14let
15 testDBOpts = {
16 host = "127.0.0.1";
17 port = "8529";
18 password = "test";
19 secret = "secret";
20 };
21in
22
23buildPythonPackage rec {
24 pname = "python-arango";
25 version = "7.5.3";
26 disabled = pythonOlder "3.7";
27 format = "setuptools";
28
29 src = fetchFromGitHub {
30 owner = "ArangoDB-Community";
31 repo = "python-arango";
32 rev = version;
33 sha256 = "0qb2yp05z8dmgsyyxqrl3q0a60jaiih96zhxmqrn2yf7as45n07j";
34 };
35
36 propagatedBuildInputs = [
37 requests
38 requests-toolbelt
39 pyjwt
40 ];
41
42 checkInputs = [
43 arangodb
44 mock
45 pytestCheckHook
46 ];
47
48 # arangodb is compiled only for particular target architectures
49 # (i.e. "haswell"). Thus, these tests may not pass reproducibly,
50 # failing with: `166: Illegal instruction` if not run on arangodb's
51 # specified architecture.
52 #
53 # nonetheless, the client library should remain in nixpkgs - since
54 # the client library will talk to arangodb across the network and
55 # architecture issues will be irrelevant.
56 doCheck = false;
57
58 preCheck = lib.optionalString doCheck ''
59 # Start test DB
60 mkdir -p .nix-test/{data,work}
61
62 ICU_DATA=${arangodb}/share/arangodb3 \
63 GLIBCXX_FORCE_NEW=1 \
64 TZ=UTC \
65 TZ_DATA=${arangodb}/share/arangodb3/tzdata \
66 ARANGO_ROOT_PASSWORD=${testDBOpts.password} \
67 ${arangodb}/bin/arangod \
68 --server.uid=$(id -u) \
69 --server.gid=$(id -g) \
70 --server.authentication=true \
71 --server.endpoint=http+tcp://${testDBOpts.host}:${testDBOpts.port} \
72 --server.descriptors-minimum=4096 \
73 --server.jwt-secret=${testDBOpts.secret} \
74 --javascript.app-path=.nix-test/app \
75 --log.file=.nix-test/log \
76 --database.directory=.nix-test/data \
77 --foxx.api=false &
78 '';
79
80 pytestFlagsArray = [
81 "--host"
82 testDBOpts.host
83 "--port"
84 testDBOpts.port
85 "--passwd"
86 testDBOpts.password
87 "--secret"
88 testDBOpts.secret
89 ];
90
91 disabledTests = [
92 # AssertionError geo-related - try enabling later
93 "test_document_find_in_box"
94
95 # maybe arangod misconfig - try enabling later
96 # arango.exceptions.JWTAuthError: [HTTP 401][ERR 401] Wrong credentials
97 "test_auth_jwt"
98
99 # ValueError - try enabling later
100 # maybe missed 3.9.3->3.10.0 changes
101 # most caused by key change: isNewlyCreated->new
102 "test_add_hash_index"
103 "test_add_skiplist_index"
104 "test_add_persistent_index"
105 "test_add_ttl_index"
106 "test_delete_index"
107 "test_pregel_management"
108
109 # formatting error - try enabling later
110 # maybe missed 3.9.3->3.10.0 changes
111 # caused by: body["computedValues"] = None
112 "test_permission_management"
113 "test_collection_misc_methods"
114 "test_collection_management"
115 "test_replication_inventory"
116
117 # want outgoing network to update foxx apis
118 # so foxx.api disabled in arangod startup
119 "test_foxx_service_management_file"
120 "test_foxx_service_management_json"
121 "test_foxx_config_management"
122 "test_foxx_dependency_management"
123 "test_foxx_development_toggle"
124 "test_foxx_misc_functions"
125
126 # no replication configured via arangod invocation
127 "test_replication_applier"
128 ];
129
130 pythonImportsCheck = [ "arango" ];
131
132 meta = with lib; {
133 description = "Python Driver for ArangoDB";
134 homepage = "https://github.com/ArangoDB-Community/python-arango";
135 license = licenses.mit;
136 maintainers = [ maintainers.jsoo1 ];
137 };
138}