@@ -240,15 +240,15 @@ def test_mixin_cleanup_random_ports():
240240
241241
242242param_values = [
243- (True , True , None ),
244- (True , False , ValueError ),
245- (False , True , None ),
246- (False , False , ValueError ),
243+ (True , True ),
244+ (True , False ),
245+ (False , True ),
246+ (False , False ),
247247]
248248
249249
250- @pytest .mark .parametrize ("file_exists, km_matches, expected_exception " , param_values )
251- def test_reconcile_connection_info (file_exists , km_matches , expected_exception ):
250+ @pytest .mark .parametrize ("file_exists, km_matches" , param_values )
251+ def test_reconcile_connection_info (file_exists , km_matches ):
252252
253253 expected_info = sample_info
254254 mismatched_info = sample_info .copy ()
@@ -272,9 +272,10 @@ def test_reconcile_connection_info(file_exists, km_matches, expected_exception):
272272 provisioner_info = info
273273 km .load_connection_info (provisioner_info )
274274 else :
275- # Let this be the case where the connection file exists, the KM has no values
276- # prior to reconciliation, but the provisioner has returned different values
277- # and a ValueError is expected.
275+ # Let this be the case where the connection file exists, and the KM has those values
276+ # that differ from the ones returned by the provisioner. This is the restart-with-
277+ # changed-ports case (typical for remote provisioners).
278+ km .load_connection_info (expected_info )
278279 provisioner_info = mismatched_info
279280 else : # connection file does not exist
280281 if km_matches :
@@ -284,20 +285,11 @@ def test_reconcile_connection_info(file_exists, km_matches, expected_exception):
284285 provisioner_info = expected_info
285286 else :
286287 # Let this be the case where the connection file does not exist, yet the KM
287- # has values that do not match those returned from the provisioner and a
288- # ValueError is expected .
288+ # has values that do not match those returned from the provisioner. This case
289+ # is probably not practical and is equivalent to the True, False case .
289290 km .load_connection_info (expected_info )
290291 provisioner_info = mismatched_info
291292
292- if expected_exception is None :
293- km ._reconcile_connection_info (provisioner_info )
294- km_info = km .get_connection_info ()
295- assert km ._equal_connections (km_info , provisioner_info )
296- else :
297- with pytest .raises (expected_exception ) as ex :
298- km ._reconcile_connection_info (provisioner_info )
299- if file_exists :
300- assert "Connection file already exists" in str (ex .value )
301- else :
302- assert "KernelManager's connection information already exists" in str (ex .value )
303- assert km ._equal_connections (km .get_connection_info (), provisioner_info ) is False
293+ km ._reconcile_connection_info (provisioner_info )
294+ km_info = km .get_connection_info ()
295+ assert km ._equal_connections (km_info , provisioner_info )
0 commit comments