1414# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515# See the License for the specific language governing permissions and
1616# limitations under the License.
17+
18+
1719import json
1820from os import path
19- import warnings
2021
2122import neo4j
2223import testkitbackend .fromtestkit as fromtestkit
2324import testkitbackend .totestkit as totestkit
2425from testkitbackend .fromtestkit import to_meta_and_timeout
2526
27+ from ._warning_check import (
28+ warning_check ,
29+ warnings_check ,
30+ )
31+
2632
2733class FrontendError (Exception ):
2834 pass
@@ -98,9 +104,21 @@ def NewDriver(backend, data):
98104 data .mark_item_as_read_if_equals ("livenessCheckTimeoutMs" , None )
99105
100106 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+ )
104122 key = backend .next_key ()
105123 backend .drivers [key ] = driver
106124 backend .send_response ("Driver" , {"id" : key })
@@ -109,19 +127,26 @@ def NewDriver(backend, data):
109127def VerifyConnectivity (backend , data ):
110128 driver_id = data ["driverId" ]
111129 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+ ):
114134 driver .verify_connectivity ()
115135 backend .send_response ("Driver" , {"id" : driver_id })
116136
117137
118138def CheckMultiDBSupport (backend , data ):
119139 driver_id = data ["driverId" ]
120140 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+ })
125150
126151
127152def resolution_func (backend , custom_resolver = False , custom_dns_resolver = False ):
0 commit comments