From ff9df3c0798dbecbe797cf9f12cf7049cb6f4aa2 Mon Sep 17 00:00:00 2001 From: hpk Date: Sun, 11 Feb 2007 19:47:04 +0100 Subject: [PATCH] [svn r38506] config.getvalue_pathlist should also honour option values (to be uniform with getvalue semantics) --HG-- branch : trunk --- py/test/config.py | 13 ++++++++----- py/test/testing/test_config.py | 4 ++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/py/test/config.py b/py/test/config.py index 3c0c2b0dc..bba884b19 100644 --- a/py/test/config.py +++ b/py/test/config.py @@ -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. diff --git a/py/test/testing/test_config.py b/py/test/testing/test_config.py index 4434b5881..12c2f240c 100644 --- a/py/test/testing/test_config.py +++ b/py/test/testing/test_config.py @@ -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])