[svn r38506] config.getvalue_pathlist should also honour option values

(to be uniform with getvalue semantics)

--HG--
branch : trunk
This commit is contained in:
hpk 2007-02-11 19:47:04 +01:00
parent 7973f472d7
commit ff9df3c079
2 changed files with 12 additions and 5 deletions

View File

@ -91,11 +91,14 @@ class Config(object):
where they were found).
"""
try:
mod, relroots = self.conftest.rget_with_confmod(name, path)
except KeyError:
return None
modpath = py.path.local(mod.__file__).dirpath()
return [modpath.join(x, abs=True) for x in relroots]
return getattr(self.option, name)
except AttributeError:
try:
mod, relroots = self.conftest.rget_with_confmod(name, path)
except KeyError:
return None
modpath = py.path.local(mod.__file__).dirpath()
return [modpath.join(x, abs=True) for x in relroots]
def addoptions(self, groupname, *specs):
""" add a named group of options to the current testing session.

View File

@ -289,6 +289,10 @@ class TestSessionAndOptions:
assert pl[0] == tmpdir
assert pl[1] == somepath
config.option.mypathlist = [py.path.local()]
pl = config.getvalue_pathlist('mypathlist')
assert pl == [py.path.local()]
def test_config_iocapturing(self):
self.tmpdir
config = py.test.config._reparse([self.tmpdir])