diff --git a/test/auto/test_auto.py b/test/auto/test_auto.py index 85780e8..f9aa7cf 100644 --- a/test/auto/test_auto.py +++ b/test/auto/test_auto.py @@ -2,6 +2,7 @@ """ import weakref import pytest +import warnings from copy import copy from py.test import raises from .autopath import do_autopath @@ -167,29 +168,30 @@ def _autocheck_default_value(cfg, path, conf, **kwargs): # test default value (should be empty) # cannot test for slave (we cannot get all values for a slave) - if not isslave: - if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False): - assert cfg.config(conf).option(path).value.get() == empty_value - assert cfg.forcepermissive.config(conf).option(path).value.get() == empty_value - elif not kwargs.get('propertyerror', False): - raises(PropertiesOptionError, "cfg.config(conf).option(path).value.get()") - assert cfg.forcepermissive.config(conf).option(path).value.get() == empty_value + with warnings.catch_warnings(record=True) as w: + if not isslave: + if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False): + assert cfg.config(conf).option(path).value.get() == empty_value + assert cfg.forcepermissive.config(conf).option(path).value.get() == empty_value + elif not kwargs.get('propertyerror', False): + raises(PropertiesOptionError, "cfg.config(conf).option(path).value.get()") + assert cfg.forcepermissive.config(conf).option(path).value.get() == empty_value + else: + raises(PropertiesOptionError, "cfg.config(conf).option(path).value.get()") + raises(PropertiesOptionError, "cfg.forcepermissive.config(conf).option(path).value.get()") else: - raises(PropertiesOptionError, "cfg.config(conf).option(path).value.get()") - raises(PropertiesOptionError, "cfg.forcepermissive.config(conf).option(path).value.get()") - else: - if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False): - assert cfg.config(conf).option(path, 0).value.get() == empty_value - assert cfg.config(conf).option(path, 1).value.get() == empty_value - assert cfg.forcepermissive.config(conf).option(path, 0).value.get() == empty_value - assert cfg.forcepermissive.config(conf).option(path, 1).value.get() == empty_value - elif not kwargs.get('propertyerror', False): - raises(PropertiesOptionError, "cfg.config(conf).option(path, 0).value.get()") - assert cfg.forcepermissive.config(conf).option(path, 0).value.get() == empty_value - assert cfg.forcepermissive.config(conf).option(path, 1).value.get() == empty_value - else: - raises(PropertiesOptionError, "cfg.config(conf).option(path, 0).value.get()") - raises(PropertiesOptionError, "cfg.forcepermissive.config(conf).option(path, 0).value.get()") + if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False): + assert cfg.config(conf).option(path, 0).value.get() == empty_value + assert cfg.config(conf).option(path, 1).value.get() == empty_value + assert cfg.forcepermissive.config(conf).option(path, 0).value.get() == empty_value + assert cfg.forcepermissive.config(conf).option(path, 1).value.get() == empty_value + elif not kwargs.get('propertyerror', False): + raises(PropertiesOptionError, "cfg.config(conf).option(path, 0).value.get()") + assert cfg.forcepermissive.config(conf).option(path, 0).value.get() == empty_value + assert cfg.forcepermissive.config(conf).option(path, 1).value.get() == empty_value + else: + raises(PropertiesOptionError, "cfg.config(conf).option(path, 0).value.get()") + raises(PropertiesOptionError, "cfg.forcepermissive.config(conf).option(path, 0).value.get()") @autocheck @@ -222,54 +224,55 @@ def _set_value(cfg, pathwrite, conf, **kwargs): # for slave should have an index and good length # for master must append, not set - if ismaster: - if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False): - raises(APIError, "cfg.config(conf).option(pathwrite, 0).value.set(first_value[0])") - if not set_permissive: - cfg.config(conf).option(pathwrite).value.set([first_value[0]]) + with warnings.catch_warnings(record=True) as w: + if ismaster: + if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False): + raises(APIError, "cfg.config(conf).option(pathwrite, 0).value.set(first_value[0])") + if not set_permissive: + cfg.config(conf).option(pathwrite).value.set([first_value[0]]) + else: + cfg.forcepermissive.config(conf).option(pathwrite).value.set([first_value[0]]) + elif not kwargs.get('propertyerror', False): + raises(PropertiesOptionError, "cfg.config(conf).option(pathwrite).value.set([first_value[0]])") + if set_permissive: + cfg.forcepermissive.config(conf).option(pathwrite).value.set([first_value[0]]) else: - cfg.forcepermissive.config(conf).option(pathwrite).value.set([first_value[0]]) - elif not kwargs.get('propertyerror', False): - raises(PropertiesOptionError, "cfg.config(conf).option(pathwrite).value.set([first_value[0]])") - if set_permissive: - cfg.forcepermissive.config(conf).option(pathwrite).value.set([first_value[0]]) - else: - raises(PropertiesOptionError, "cfg.config(conf).option(pathwrite).value.set([first_value[0]])") - raises(PropertiesOptionError, - "cfg.forcepermissive.config(conf).option(pathwrite).value.set([first_value[0]])") - if len(first_value) > 1: - raises(APIError, "cfg.unrestraint.config(conf).option(pathwrite).value.set(first_value[1])") - elif isslave: - if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False): - if not set_permissive: - cfg.config(conf).option(pathwrite, 1).value.set(second_value) + raises(PropertiesOptionError, "cfg.config(conf).option(pathwrite).value.set([first_value[0]])") + raises(PropertiesOptionError, + "cfg.forcepermissive.config(conf).option(pathwrite).value.set([first_value[0]])") + if len(first_value) > 1: + raises(APIError, "cfg.unrestraint.config(conf).option(pathwrite).value.set(first_value[1])") + elif isslave: + if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False): + if not set_permissive: + cfg.config(conf).option(pathwrite, 1).value.set(second_value) + else: + cfg.forcepermissive.config(conf).option(pathwrite, 1).value.set(second_value) + elif not kwargs.get('propertyerror', False): + raises(PropertiesOptionError, "cfg.config(conf).option(pathwrite, 1).value.set(second_value)") + if set_permissive: + cfg.forcepermissive.config(conf).option(pathwrite, 1).value.set(second_value) else: - cfg.forcepermissive.config(conf).option(pathwrite, 1).value.set(second_value) - elif not kwargs.get('propertyerror', False): - raises(PropertiesOptionError, "cfg.config(conf).option(pathwrite, 1).value.set(second_value)") - if set_permissive: - cfg.forcepermissive.config(conf).option(pathwrite, 1).value.set(second_value) - else: - raises(PropertiesOptionError, "cfg.config(conf).option(pathwrite, 1).value.set(second_value)") - raises(PropertiesOptionError, - "cfg.forcepermissive.config(conf).option(pathwrite, 1).value.set(second_value)") - raises(APIError, - "cfg.unrestraint.config(conf).option(pathwrite).value.set([second_value, second_value])") + raises(PropertiesOptionError, "cfg.config(conf).option(pathwrite, 1).value.set(second_value)") + raises(PropertiesOptionError, + "cfg.forcepermissive.config(conf).option(pathwrite, 1).value.set(second_value)") + raises(APIError, + "cfg.unrestraint.config(conf).option(pathwrite).value.set([second_value, second_value])") - else: - if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False): - if not set_permissive: - cfg.config(conf).option(pathwrite).value.set(first_value) - else: - cfg.forcepermissive.config(conf).option(pathwrite).value.set(first_value) - elif not kwargs.get('propertyerror', False): - raises(PropertiesOptionError, "cfg.config(conf).option(pathwrite).value.set(first_value)") - if set_permissive: - cfg.forcepermissive.config(conf).option(pathwrite).value.set(first_value) else: - raises(PropertiesOptionError, "cfg.config(conf).option(pathwrite).value.set(first_value)") - raises(PropertiesOptionError, "cfg.forcepermissive.config(conf).option(pathwrite).value.set(first_value)") - #FIXME raises(APIError, "cfg.unrestraint.config(conf).option(pathwrite).value.set(first_value)") + if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False): + if not set_permissive: + cfg.config(conf).option(pathwrite).value.set(first_value) + else: + cfg.forcepermissive.config(conf).option(pathwrite).value.set(first_value) + elif not kwargs.get('propertyerror', False): + raises(PropertiesOptionError, "cfg.config(conf).option(pathwrite).value.set(first_value)") + if set_permissive: + cfg.forcepermissive.config(conf).option(pathwrite).value.set(first_value) + else: + raises(PropertiesOptionError, "cfg.config(conf).option(pathwrite).value.set(first_value)") + raises(PropertiesOptionError, "cfg.forcepermissive.config(conf).option(pathwrite).value.set(first_value)") + #FIXME raises(APIError, "cfg.unrestraint.config(conf).option(pathwrite).value.set(first_value)") @autocheck @@ -318,17 +321,19 @@ def autocheck_get_value_permissive(cfg, pathread, pathwrite, confread, confwrite raises(PropertiesOptionError, "assert cfg.forcepermissive.config(conf).option(pathread, 1).value.get()") else: if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False): - assert cfg.config(conf).option(pathread).value.get() == first_value - assert cfg.forcepermissive.config(conf).option(pathread).value.get() == first_value + with warnings.catch_warnings(record=True) as w: + assert cfg.config(conf).option(pathread).value.get() == first_value + assert cfg.forcepermissive.config(conf).option(pathread).value.get() == first_value elif kwargs.get('permissive', False): raises(PropertiesOptionError, "cfg.config(conf).option(pathread).value.get()") assert cfg.forcepermissive.config(conf).option(pathread).value.get() == first_value else: raises(PropertiesOptionError, "cfg.config(conf).option(pathread).value.get()") raises(PropertiesOptionError, "cfg.forcepermissive.config(conf).option(pathread).value.get()") - do(confread) - if confread != confwrite: - do(confwrite) + with warnings.catch_warnings(record=True) as w: + do(confread) + if confread != confwrite: + do(confwrite) def _autocheck_get_value(cfg, pathread, conf, **kwargs): @@ -352,35 +357,36 @@ def _autocheck_get_value(cfg, pathread, conf, **kwargs): second_value = SUBLIST_SECOND_VALUE[1] # get value after set value without permissive - if isslave: - if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False): - assert cfg.config(conf).option(pathread, 0).value.get() == empty_value - assert cfg.config(conf).option(pathread, 1).value.get() == second_value - assert cfg.forcepermissive.config(conf).option(pathread, 0).value.get() == empty_value - assert cfg.forcepermissive.config(conf).option(pathread, 1).value.get() == second_value - elif kwargs.get('permissive', False): - raises(PropertiesOptionError, "cfg.config(conf).option(pathread, 0).value.get()") - assert cfg.forcepermissive.config(conf).option(pathread, 0).value.get() == empty_value - if set_permissive: + with warnings.catch_warnings(record=True) as w: + if isslave: + if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False): + assert cfg.config(conf).option(pathread, 0).value.get() == empty_value + assert cfg.config(conf).option(pathread, 1).value.get() == second_value + assert cfg.forcepermissive.config(conf).option(pathread, 0).value.get() == empty_value assert cfg.forcepermissive.config(conf).option(pathread, 1).value.get() == second_value + elif kwargs.get('permissive', False): + raises(PropertiesOptionError, "cfg.config(conf).option(pathread, 0).value.get()") + assert cfg.forcepermissive.config(conf).option(pathread, 0).value.get() == empty_value + if set_permissive: + assert cfg.forcepermissive.config(conf).option(pathread, 1).value.get() == second_value + else: + assert cfg.forcepermissive.config(conf).option(pathread, 1).value.get() == empty_value else: - assert cfg.forcepermissive.config(conf).option(pathread, 1).value.get() == empty_value + raises(PropertiesOptionError, "cfg.config(conf).option(pathread, 0).value.get()") + raises(PropertiesOptionError, "cfg.forcepermissive.config(conf).option(pathread, 0).value.get()") else: - raises(PropertiesOptionError, "cfg.config(conf).option(pathread, 0).value.get()") - raises(PropertiesOptionError, "cfg.forcepermissive.config(conf).option(pathread, 0).value.get()") - else: - if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False): - assert cfg.config(conf).option(pathread).value.get() == first_value - assert cfg.forcepermissive.config(conf).option(pathread).value.get() == first_value - elif kwargs.get('permissive', False): - raises(PropertiesOptionError, "cfg.config(conf).option(pathread).value.get()") - if set_permissive: + if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False): + assert cfg.config(conf).option(pathread).value.get() == first_value assert cfg.forcepermissive.config(conf).option(pathread).value.get() == first_value + elif kwargs.get('permissive', False): + raises(PropertiesOptionError, "cfg.config(conf).option(pathread).value.get()") + if set_permissive: + assert cfg.forcepermissive.config(conf).option(pathread).value.get() == first_value + else: + assert cfg.forcepermissive.config(conf).option(pathread).value.get() == empty_value else: - assert cfg.forcepermissive.config(conf).option(pathread).value.get() == empty_value - else: - raises(PropertiesOptionError, "cfg.config(conf).option(pathread).value.get()") - raises(PropertiesOptionError, "cfg.forcepermissive.config(conf).option(pathread).value.get()") + raises(PropertiesOptionError, "cfg.config(conf).option(pathread).value.get()") + raises(PropertiesOptionError, "cfg.forcepermissive.config(conf).option(pathread).value.get()") @autocheck @@ -426,8 +432,9 @@ def autocheck_value_slave(cfg, pathread, pathwrite, confread, confwrite, **kwarg length = 2 value = [] - for idx in range(length): - value.append(cfg.forcepermissive.option(pathread, idx).value.get()) + with warnings.catch_warnings(record=True) as w: + for idx in range(length): + value.append(cfg.forcepermissive.option(pathread, idx).value.get()) assert value == [empty_value, empty_value] # cannot access to a slave with index too high @@ -467,16 +474,17 @@ def autocheck_reset_value(cfg, pathread, pathwrite, confread, confwrite, **kwarg _set_value(cfg, pathwrite, confwrite, **kwargs) # reset value without permissive - if not isslave: - if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False): - cfg.config(confwrite).option(pathwrite).value.reset() - #else: - #FIXME raises(PropertiesOptionError, "cfg.config(confwrite).option(pathwrite).value.reset()") - else: - if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False): - cfg.config(confwrite).option(pathwrite, 0).value.reset() - #else: - #FIXME raises(PropertiesOptionError, "cfg.config(confwrite).option(pathwrite, 0).value.reset()") + with warnings.catch_warnings(record=True) as w: + if not isslave: + if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False): + cfg.config(confwrite).option(pathwrite).value.reset() + #else: + #FIXME raises(PropertiesOptionError, "cfg.config(confwrite).option(pathwrite).value.reset()") + else: + if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False): + cfg.config(confwrite).option(pathwrite, 0).value.reset() + #else: + #FIXME raises(PropertiesOptionError, "cfg.config(confwrite).option(pathwrite, 0).value.reset()") # get value after reset value without permissive def do(conf): @@ -494,9 +502,10 @@ def autocheck_reset_value(cfg, pathread, pathwrite, confread, confwrite, **kwarg elif kwargs.get('permissive', False): raises(PropertiesOptionError, "cfg.config(conf).option(pathread).value.get()") assert cfg.forcepermissive.config(conf).option(pathread).value.get() == first_value - do(confread) - if confread != confwrite: - do(confwrite) + with warnings.catch_warnings(record=True) as w: + do(confread) + if confread != confwrite: + do(confwrite) @autocheck @@ -506,32 +515,34 @@ def autocheck_append_value(cfg, pathread, pathwrite, confread, confwrite, **kwar if not ismaster: return - if not kwargs.get('propertyerror', False): - master_value = cfg.forcepermissive.config(confread).option(pathread).value.get() - len_value = len(master_value) - master_value.append(undefined) - assert len(cfg.forcepermissive.config(confread).option(pathread).value.get()) == len_value - cfg.forcepermissive.config(confwrite).option(pathread).value.set(master_value) - new_master_value = cfg.forcepermissive.config(confread).option(pathread).value.get() - len_new = len(new_master_value) - assert len_value + 1 == len_new - assert new_master_value[-1] == kwargs['default_multi'] - slave_path = pathread.rsplit('.', 1)[0] - if slave_path.endswith('val1') or slave_path.endswith('val2'): - slave_path += '.third' + slave_path[-4:] - else: - slave_path += '.third' - for idx in range(len_new): - assert cfg.forcepermissive.config(confread).option(slave_path, idx).value.get() == kwargs['default_multi'] - # - if not submulti_: - value = 'value' - else: - value = ['value'] - master_value.append(value) - assert len(cfg.forcepermissive.config(confread).option(pathread).value.get()) == len(new_master_value) - cfg.forcepermissive.config(confwrite).option(pathread).value.set(master_value) - assert cfg.forcepermissive.config(confread).option(pathread).value.get()[-1] == value + with warnings.catch_warnings(record=True) as w: + if not kwargs.get('propertyerror', False): + master_value = cfg.forcepermissive.config(confread).option(pathread).value.get() + len_value = len(master_value) + master_value.append(undefined) + assert len(cfg.forcepermissive.config(confread).option(pathread).value.get()) == len_value + with warnings.catch_warnings(record=True) as w: + cfg.forcepermissive.config(confwrite).option(pathread).value.set(master_value) + new_master_value = cfg.forcepermissive.config(confread).option(pathread).value.get() + len_new = len(new_master_value) + assert len_value + 1 == len_new + assert new_master_value[-1] == kwargs['default_multi'] + slave_path = pathread.rsplit('.', 1)[0] + if slave_path.endswith('val1') or slave_path.endswith('val2'): + slave_path += '.third' + slave_path[-4:] + else: + slave_path += '.third' + for idx in range(len_new): + assert cfg.forcepermissive.config(confread).option(slave_path, idx).value.get() == kwargs['default_multi'] + # + if not submulti_: + value = 'value' + else: + value = ['value'] + master_value.append(value) + assert len(cfg.forcepermissive.config(confread).option(pathread).value.get()) == len(new_master_value) + cfg.forcepermissive.config(confwrite).option(pathread).value.set(master_value) + assert cfg.forcepermissive.config(confread).option(pathread).value.get()[-1] == value @autocheck @@ -554,34 +565,35 @@ def autocheck_pop_value(cfg, pathread, pathwrite, confread, confwrite, **kwargs) a_slave += '.third' + a_slave[-4:] else: a_slave += '.third' - cfg.forcepermissive.config(confwrite).option(pathread).value.set(values) - cfg.forcepermissive.config(confwrite).option(a_slave, 1).value.set(slave_value) - cfg.forcepermissive.config(confread).option(a_slave, 0).value.get() == kwargs['default_multi'] - assert cfg.forcepermissive.config(confread).option(a_slave, 0).owner.isdefault() is True - cfg.forcepermissive.config(confread).option(a_slave, 1).value.get() == slave_value - assert cfg.forcepermissive.config(confread).option(a_slave, 1).owner.isdefault() is False - cfg.forcepermissive.config(confread).option(a_slave, 2).value.get() == kwargs['default_multi'] - assert cfg.forcepermissive.config(confread).option(a_slave, 2).owner.isdefault() is True - cfg.forcepermissive.config(confread).option(a_slave, 3).value.get() == kwargs['default_multi'] - assert cfg.forcepermissive.config(confread).option(a_slave, 3).owner.isdefault() is True - # - cfg.forcepermissive.config(confwrite).option(pathread).value.pop(3) - cfg.forcepermissive.config(confread).option(a_slave, 0).value.get() == kwargs['default_multi'] - assert cfg.forcepermissive.config(confread).option(a_slave, 0).owner.isdefault() is True - cfg.forcepermissive.config(confread).option(a_slave, 1).value.get() == slave_value - assert cfg.forcepermissive.config(confread).option(a_slave, 1).owner.isdefault() is False - cfg.forcepermissive.config(confread).option(a_slave, 2).value.get() == kwargs['default_multi'] - assert cfg.forcepermissive.config(confread).option(a_slave, 2).owner.isdefault() is True - # - cfg.forcepermissive.config(confwrite).option(pathread).value.pop(0) - cfg.forcepermissive.config(confread).option(a_slave, 0).value.get() == slave_value - assert cfg.forcepermissive.config(confread).option(a_slave, 0).owner.isdefault() is False - cfg.forcepermissive.config(confread).option(a_slave, 1).value.get() == kwargs['default_multi'] - assert cfg.forcepermissive.config(confread).option(a_slave, 1).owner.isdefault() is True - # - cfg.forcepermissive.config(confwrite).option(pathread).value.pop(0) - cfg.forcepermissive.config(confread).option(a_slave, 0).value.get() == kwargs['default_multi'] - assert cfg.forcepermissive.config(confread).option(a_slave, 0).owner.isdefault() is True + with warnings.catch_warnings(record=True) as w: + cfg.forcepermissive.config(confwrite).option(pathread).value.set(values) + cfg.forcepermissive.config(confwrite).option(a_slave, 1).value.set(slave_value) + cfg.forcepermissive.config(confread).option(a_slave, 0).value.get() == kwargs['default_multi'] + assert cfg.forcepermissive.config(confread).option(a_slave, 0).owner.isdefault() is True + cfg.forcepermissive.config(confread).option(a_slave, 1).value.get() == slave_value + assert cfg.forcepermissive.config(confread).option(a_slave, 1).owner.isdefault() is False + cfg.forcepermissive.config(confread).option(a_slave, 2).value.get() == kwargs['default_multi'] + assert cfg.forcepermissive.config(confread).option(a_slave, 2).owner.isdefault() is True + cfg.forcepermissive.config(confread).option(a_slave, 3).value.get() == kwargs['default_multi'] + assert cfg.forcepermissive.config(confread).option(a_slave, 3).owner.isdefault() is True + # + cfg.forcepermissive.config(confwrite).option(pathread).value.pop(3) + cfg.forcepermissive.config(confread).option(a_slave, 0).value.get() == kwargs['default_multi'] + assert cfg.forcepermissive.config(confread).option(a_slave, 0).owner.isdefault() is True + cfg.forcepermissive.config(confread).option(a_slave, 1).value.get() == slave_value + assert cfg.forcepermissive.config(confread).option(a_slave, 1).owner.isdefault() is False + cfg.forcepermissive.config(confread).option(a_slave, 2).value.get() == kwargs['default_multi'] + assert cfg.forcepermissive.config(confread).option(a_slave, 2).owner.isdefault() is True + # + cfg.forcepermissive.config(confwrite).option(pathread).value.pop(0) + cfg.forcepermissive.config(confread).option(a_slave, 0).value.get() == slave_value + assert cfg.forcepermissive.config(confread).option(a_slave, 0).owner.isdefault() is False + cfg.forcepermissive.config(confread).option(a_slave, 1).value.get() == kwargs['default_multi'] + assert cfg.forcepermissive.config(confread).option(a_slave, 1).owner.isdefault() is True + # + cfg.forcepermissive.config(confwrite).option(pathread).value.pop(0) + cfg.forcepermissive.config(confread).option(a_slave, 0).value.get() == kwargs['default_multi'] + assert cfg.forcepermissive.config(confread).option(a_slave, 0).owner.isdefault() is True @autocheck @@ -590,24 +602,25 @@ def autocheck_reset_value_permissive(cfg, pathread, pathwrite, confread, confwri isslave = cfg.unrestraint.option(pathread).option.isslave() _set_value(cfg, pathwrite, confwrite, **kwargs) # reset value with permissive - if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False): - if not isslave: - cfg.forcepermissive.config(confwrite).option(pathwrite).value.reset() - else: - cfg.forcepermissive.option(pathwrite, 1).value.reset() - elif kwargs.get('permissive', False): - if not isslave: - cfg.forcepermissive.config(confwrite).option(pathwrite).value.reset() - else: - cfg.forcepermissive.option(pathwrite, 1).value.reset() - #FIXME else: - # if not isslave: - # raises(PropertiesOptionError, "cfg.forcepermissive.config(confwrite).option(pathwrite).value.reset()") - # else: - # raises(PropertiesOptionError, "cfg.forcepermissive.option(pathwrite, 1).value.reset()") - _autocheck_default_value(cfg, pathread, confread, **kwargs) - if confread != confwrite: - _autocheck_default_value(cfg, pathwrite, confwrite, **kwargs) + with warnings.catch_warnings(record=True) as w: + if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False): + if not isslave: + cfg.forcepermissive.config(confwrite).option(pathwrite).value.reset() + else: + cfg.forcepermissive.option(pathwrite, 1).value.reset() + elif kwargs.get('permissive', False): + if not isslave: + cfg.forcepermissive.config(confwrite).option(pathwrite).value.reset() + else: + cfg.forcepermissive.option(pathwrite, 1).value.reset() + #FIXME else: + # if not isslave: + # raises(PropertiesOptionError, "cfg.forcepermissive.config(confwrite).option(pathwrite).value.reset()") + # else: + # raises(PropertiesOptionError, "cfg.forcepermissive.option(pathwrite, 1).value.reset()") + _autocheck_default_value(cfg, pathread, confread, **kwargs) + if confread != confwrite: + _autocheck_default_value(cfg, pathwrite, confwrite, **kwargs) @autocheck @@ -1329,14 +1342,16 @@ def check_all(cfg, paths_, path, meta, multi, default, default_multi, require, c value = SUBLIST_SECOND_VALUE else: value = LIST_SECOND_VALUE - ncfg.option(master_path).value.set(value) + with warnings.catch_warnings(record=True) as w: + ncfg.option(master_path).value.set(value) ckwargs['make_dict'][master_path] = value ckwargs['make_dict_value'][master_path] = value if symlink: ckwargs['make_dict'][master_path + 'link'] = value ckwargs['make_dict_value'][master_path + 'link'] = value if master_path_2: - ncfg.option(master_path_2).value.set(value) + with warnings.catch_warnings(record=True) as w: + ncfg.option(master_path_2).value.set(value) ckwargs['make_dict'][master_path_2] = value ckwargs['make_dict_value'][master_path_2] = value if symlink: