def test_no_save_path(): """trying to save without a config path is an error""" s = NapariSettings(config_path=None) assert s.config_path is None with pytest.raises(ValueError): # the original `save()` method is patched in conftest.fresh_settings # so we "unmock" it here to assert the failure NapariSettings.__original_save__(s) # type: ignore
def _mock_save(self, path=None, **dict_kwargs): if not (path or self.config_path): return NapariSettings.__original_save__(self, path, **dict_kwargs)