find in api return an api object
This commit is contained in:
@ -1074,6 +1074,7 @@ def autocheck_option_get(api, pathread, pathwrite, confread, confwrite, **kwargs
|
||||
@autocheck
|
||||
def autocheck_find(api, pathread, pathwrite, confread, confwrite, **kwargs):
|
||||
def _getoption(opt):
|
||||
opt = opt.option.get()
|
||||
if opt.impl_is_dynsymlinkoption():
|
||||
opt = opt.impl_getopt()
|
||||
return opt
|
||||
@ -1088,7 +1089,7 @@ def autocheck_find(api, pathread, pathwrite, confread, confwrite, **kwargs):
|
||||
name = pathread.rsplit('.', 1)[1]
|
||||
else:
|
||||
name = pathread
|
||||
option = _getoption(api.unrestraint.option(pathread).option.get())
|
||||
option = _getoption(api.unrestraint.option(pathread))
|
||||
|
||||
def do(conf):
|
||||
if not kwargs.get('permissive', False) and not kwargs.get('propertyerror', False):
|
||||
@ -1102,8 +1103,6 @@ def autocheck_find(api, pathread, pathwrite, confread, confwrite, **kwargs):
|
||||
raises(AttributeError, "api.forcepermissive.config(conf).option.find(name, first=True)")
|
||||
assert option == _getoption(api.unrestraint.config(conf).option.find(name, first=True))
|
||||
assert [option] == _getoptions(api.unrestraint.config(conf).option.find(name))
|
||||
assert pathread == api.unrestraint.config(conf).option.find(name, 'path', first=True)
|
||||
assert [pathread] == api.unrestraint.config(conf).option.find(name, 'path')
|
||||
do(confread)
|
||||
if confread != confwrite:
|
||||
do(confwrite)
|
||||
|
Reference in New Issue
Block a user