remove warnings in tests

This commit is contained in:
Emmanuel Garette 2018-08-18 16:11:25 +02:00
parent 7340ceb173
commit 5f8cd546e7
1 changed files with 199 additions and 184 deletions

View File

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