From de59516c934c71b69d7b88902356334eb9917a10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20H=C3=BCnnemeyer?= Date: Wed, 20 Feb 2019 13:06:41 +0100 Subject: [PATCH] Look in the tests root dir for jira.cfg and not only in the current dir (#100) * Look in the tests root dir for jira.cfg and not only in the current dir * Make use of os.path.join * Convert paths to str * Convert rootdir info from parser to str * Removed explicit conversion PathLike -> str --- README.rst | 1 + pytest_jira.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 47447b0..bfa6076 100644 --- a/README.rst +++ b/README.rst @@ -167,6 +167,7 @@ Usage * /etc/jira.cfg * ~/jira.cfg * tests\_root\_dir/jira.cfg + * tests\_test\_dir/jira.cfg The configuration file is loaded in that order mentioned above. That means that first options from global configuration are loaded, diff --git a/pytest_jira.py b/pytest_jira.py index a00fc79..f49a525 100644 --- a/pytest_jira.py +++ b/pytest_jira.py @@ -337,8 +337,9 @@ def pytest_addoption(parser): # FIXME - Change to a credentials.yaml ? config = six.moves.configparser.ConfigParser() config.read([ - '/etc/jira.cfg', - os.path.expanduser('~/jira.cfg'), + os.path.join('/', 'etc', 'jira.cfg'), + os.path.join(str(parser.extra_info['rootdir']), 'jira.cfg'), + os.path.expanduser(os.path.join('~', 'jira.cfg')), 'jira.cfg', ])