@@ -226,10 +226,15 @@ def metadata(self):
226
226
raise self .__exc ('What a spectacular failure, you say!' )
227
227
228
228
# exception types get caught!
229
- for exc in [FileNotFoundError , CivisJobFailure , KeyError , CancelledError ]:
229
+ for exc in [FileNotFoundError , CivisJobFailure , CancelledError ]:
230
230
fut = ModelFutureRaiseExc (exc , 1 , 2 , client = mock_client )
231
231
_model .ModelFuture ._set_model_exception (fut )
232
232
233
+ with pytest .warns (UserWarning ):
234
+ # The KeyError is caught, but sends a warning
235
+ fut = ModelFutureRaiseExc (KeyError , 1 , 2 , client = mock_client )
236
+ _model .ModelFuture ._set_model_exception (fut )
237
+
233
238
fut = ModelFutureRaiseExc (RuntimeError , 1 , 2 , client = mock_client )
234
239
with pytest .raises (RuntimeError ):
235
240
_model .ModelFuture ._set_model_exception (fut )
@@ -421,7 +426,8 @@ def poller(*args, **kwargs):
421
426
mock_client .scripts .get_containers_runs = poller
422
427
423
428
path = '/green/eggs/and/ham'
424
- training_meta = {'run' : {'configuration' : {'data' : {'location' : path }}}}
429
+ training_meta = {'run' : {'configuration' : {'data' : {'location' : path }},
430
+ 'status' : 'succeeded' }}
425
431
mock_cio .file_to_json .return_value = training_meta
426
432
427
433
mf = _model .ModelFuture (job_id = 1 , run_id = 2 , train_job_id = 11 ,
@@ -496,7 +502,9 @@ def test_validation_metadata_prediction(mock_spe, mock_f2f,
496
502
497
503
@mock .patch .object (_model .cio , "file_id_from_run_output" , autospec = True )
498
504
@mock .patch .object (_model .cio , "file_to_json" ,
499
- mock .MagicMock (return_value = {'metrics' : 'foo' }))
505
+ mock .MagicMock (
506
+ return_value = {'metrics' : 'foo' ,
507
+ 'run' : {'status' : 'succeeded' }}))
500
508
def test_metrics_training (mock_file_id_from_run_output ):
501
509
mock_file_id_from_run_output .return_value = 11
502
510
c = setup_client_mock (3 , 7 )
@@ -509,7 +517,9 @@ def test_metrics_training(mock_file_id_from_run_output):
509
517
510
518
@mock .patch .object (_model .cio , "file_id_from_run_output" , autospec = True )
511
519
@mock .patch .object (_model .cio , "file_to_json" ,
512
- mock .MagicMock (return_value = {'metrics' : 'foo' }))
520
+ mock .MagicMock (
521
+ return_value = {'metrics' : 'foo' ,
522
+ 'run' : {'status' : 'succeeded' }}))
513
523
def test_metrics_prediction (mock_file_id_from_run_output ):
514
524
mock_file_id_from_run_output .return_value = 11
515
525
c = setup_client_mock (3 , 7 )
0 commit comments