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])