diff --git a/tests/a_scripts/eval/test_eval_inputs.py b/tests/a_scripts/eval/test_eval_inputs.py index 98b15743b3..3e1fc83b09 100644 --- a/tests/a_scripts/eval/test_eval_inputs.py +++ b/tests/a_scripts/eval/test_eval_inputs.py @@ -42,12 +42,13 @@ def test_mispelled_mandatory_params_fail(self, cfg: DictConfig) -> None: omegaconf.errors.InterpolationKeyError, omegaconf.errors.MissingMandatoryValue, TypeError, + ValueError, )): cfg[p + '-mispelled'] = cfg.pop(p) main(cfg) cfg[p] = cfg.pop(p + '-mispelled') - def test_optional_mispelled_params_raise_warning( + def test_optional_mispelled_params_raise_error( self, cfg: DictConfig, ) -> None: @@ -67,15 +68,11 @@ def test_optional_mispelled_params_raise_warning( orig_value = cfg.pop(param, None) updated_param = param + '-mispelling' cfg[updated_param] = orig_value - with warnings.catch_warnings(record=True) as warning_list: + with pytest.raises(ValueError): try: main(cfg) except: pass - assert any( - f'Unused parameter {updated_param} found in cfg.' in - str(warning.message) for warning in warning_list - ) # restore configs. cfg = copy.deepcopy(old_cfg) diff --git a/tests/a_scripts/train/test_train_inputs.py b/tests/a_scripts/train/test_train_inputs.py index 5a3b21dc3b..6806772534 100644 --- a/tests/a_scripts/train/test_train_inputs.py +++ b/tests/a_scripts/train/test_train_inputs.py @@ -89,7 +89,7 @@ def test_missing_mandatory_parameters_fail(self, cfg: DictConfig) -> None: main(cfg) cfg[param] = orig_param - def test_optional_misspelled_params_raise_warning( + def test_optional_misspelled_params_raise_error( self, cfg: DictConfig, ) -> None: @@ -113,15 +113,11 @@ def test_optional_misspelled_params_raise_warning( orig_value = cfg.pop(param, None) updated_param = param + '-misspelling' cfg[updated_param] = orig_value - with warnings.catch_warnings(record=True) as warning_list: + with pytest.raises(ValueError): try: main(cfg) except: pass - assert any( - f'Unused parameter {updated_param} found in cfg.' in - str(warning.message) for warning in warning_list - ) # restore configs. cfg = copy.deepcopy(old_cfg)