@@ -80,7 +80,7 @@ class FaultInjector: | |||||
if param['fi_type'] not in attr: | if param['fi_type'] not in attr: | ||||
msg = "'Undefined fault type', got {}.".format(self.fi_type_map[param['fi_type']]) | msg = "'Undefined fault type', got {}.".format(self.fi_type_map[param['fi_type']]) | ||||
LOGGER.error(TAG, msg) | LOGGER.error(TAG, msg) | ||||
raise AttributeError(msg) | |||||
raise ValueError(msg) | |||||
if param['fi_mode'] not in ['single_layer', 'all_layer']: | if param['fi_mode'] not in ['single_layer', 'all_layer']: | ||||
msg = "'fault mode should be single_layer or all_layer', but got {}.".format(param['fi_mode']) | msg = "'fault mode should be single_layer or all_layer', but got {}.".format(param['fi_mode']) | ||||
LOGGER.error(TAG, msg) | LOGGER.error(TAG, msg) | ||||
@@ -195,11 +195,11 @@ def test_wrong_fi_type(): | |||||
fi_size = [1] | fi_size = [1] | ||||
# Fault injection | # Fault injection | ||||
with pytest.raises(AttributeError) as exc_info: | |||||
with pytest.raises(ValueError) as exc_info: | |||||
fi = FaultInjector(model, fi_type, fi_mode, fi_size) | fi = FaultInjector(model, fi_type, fi_mode, fi_size) | ||||
_ = fi.kick_off(ds_data, ds_label, iter_times=100) | _ = fi.kick_off(ds_data, ds_label, iter_times=100) | ||||
_ = fi.metrics() | _ = fi.metrics() | ||||
assert exc_info.type is AttributeError | |||||
assert exc_info.type is ValueError | |||||
@pytest.mark.level0 | @pytest.mark.level0 | ||||