14
14
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
15
# See the License for the specific language governing permissions and
16
16
# limitations under the License.
17
+
18
+
17
19
import json
18
20
from os import path
19
- import warnings
20
21
21
22
import neo4j
22
23
import testkitbackend .fromtestkit as fromtestkit
23
24
import testkitbackend .totestkit as totestkit
24
25
from testkitbackend .fromtestkit import to_meta_and_timeout
25
26
27
+ from ._warning_check import (
28
+ warning_check ,
29
+ warnings_check ,
30
+ )
31
+
26
32
27
33
class FrontendError (Exception ):
28
34
pass
@@ -98,9 +104,21 @@ def NewDriver(backend, data):
98
104
data .mark_item_as_read_if_equals ("livenessCheckTimeoutMs" , None )
99
105
100
106
data .mark_item_as_read ("domainNameResolverRegistered" )
101
- driver = neo4j .GraphDatabase .driver (
102
- data ["uri" ], auth = auth , user_agent = data ["userAgent" ], ** kwargs
103
- )
107
+ expected_warnings = []
108
+ if "update_routing_table_timeout" in kwargs :
109
+ expected_warnings .append ((
110
+ DeprecationWarning ,
111
+ "The 'update_routing_table_timeout' config key is deprecated"
112
+ ))
113
+ if "session_connection_timeout" in kwargs :
114
+ expected_warnings .append ((
115
+ DeprecationWarning ,
116
+ "The 'session_connection_timeout' config key is deprecated"
117
+ ))
118
+ with warnings_check (expected_warnings ):
119
+ driver = neo4j .GraphDatabase .driver (
120
+ data ["uri" ], auth = auth , user_agent = data ["userAgent" ], ** kwargs
121
+ )
104
122
key = backend .next_key ()
105
123
backend .drivers [key ] = driver
106
124
backend .send_response ("Driver" , {"id" : key })
@@ -109,19 +127,26 @@ def NewDriver(backend, data):
109
127
def VerifyConnectivity (backend , data ):
110
128
driver_id = data ["driverId" ]
111
129
driver = backend .drivers [driver_id ]
112
- with warnings .catch_warnings ():
113
- warnings .simplefilter ("ignore" , category = neo4j .ExperimentalWarning )
130
+ with warning_check (
131
+ neo4j .ExperimentalWarning ,
132
+ "The configuration may change in the future."
133
+ ):
114
134
driver .verify_connectivity ()
115
135
backend .send_response ("Driver" , {"id" : driver_id })
116
136
117
137
118
138
def CheckMultiDBSupport (backend , data ):
119
139
driver_id = data ["driverId" ]
120
140
driver = backend .drivers [driver_id ]
121
- backend .send_response (
122
- "MultiDBSupport" ,
123
- {"id" : backend .next_key (), "available" : driver .supports_multi_db ()}
124
- )
141
+ with warning_check (
142
+ neo4j .ExperimentalWarning ,
143
+ "Feature support query, based on Bolt protocol version and Neo4j "
144
+ "server version will change in the future."
145
+ ):
146
+ available = driver .supports_multi_db ()
147
+ backend .send_response ("MultiDBSupport" , {
148
+ "id" : backend .next_key (), "available" : available
149
+ })
125
150
126
151
127
152
def resolution_func (backend , custom_resolver = False , custom_dns_resolver = False ):
0 commit comments