From 1e569c4f467b2941191316a80610c907b7c7c8cb Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Fri, 9 Nov 2018 11:29:56 +0100 Subject: [PATCH] Fix Module 'pytest' has no 'config' member pytest.config is created dynamically. See: https://pagure.io/freeipa/issue/7758 Signed-off-by: Christian Heimes Reviewed-By: Alexander Bokovoy --- ipatests/util.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ipatests/util.py b/ipatests/util.py index 21dd7d346..1dbf7c4b3 100644 --- a/ipatests/util.py +++ b/ipatests/util.py @@ -71,7 +71,8 @@ PYTEST_VERSION = tuple(int(v) for v in pytest.__version__.split('.')) def check_ipaclient_unittests(reason="Skip in ipaclient unittest mode"): """Call this in a package to skip the package in ipaclient-unittest mode """ - if pytest.config.getoption('ipaclient_unittests', False): + config = pytest.config # pylint: disable=no-member + if config.getoption('ipaclient_unittests', False): if PYTEST_VERSION[0] >= 3: # pytest 3+ does no longer allow pytest.skip() on module level # pylint: disable=unexpected-keyword-arg @@ -84,7 +85,8 @@ def check_ipaclient_unittests(reason="Skip in ipaclient unittest mode"): def check_no_ipaapi(reason="Skip tests that needs an IPA API"): """Call this in a package to skip the package in no-ipaapi mode """ - if pytest.config.getoption('skip_ipaapi', False): + config = pytest.config # pylint: disable=no-member + if config.getoption('skip_ipaapi', False): if PYTEST_VERSION[0] >= 3: # pylint: disable=unexpected-keyword-arg raise pytest.skip.Exception(reason, allow_module_level=True)