def _reset_the_config(self): keys = self.init_keys for key in keys: ikey = 'init_{0}'.format(key) if hasattr(self, ikey): k = '_{0}'.format(key) if 'traceback' in key else key config.__setattr__(k, self.__getattribute__(ikey))
def test_set_wrong(self, var, toval): with pytest.raises(ValueError) as cm: config.__setattr__(var, toval) assert 'config.{0} must be'.format(var) in str(cm.value)