From 46518b494f215a49c1906508a1bb9661e30dcd98 Mon Sep 17 00:00:00 2001 From: Stanislav Levin Date: Apr 22 2020 08:01:25 +0000 Subject: ipatests: Remove no longer needed 'skip' compatibility Since the required Pytest is 3.9.1+ the compat 'pytest.skip' for Pytest < 3 can be removed. Fixes: https://pagure.io/freeipa/issue/8101 Signed-off-by: Stanislav Levin Reviewed-By: Sergey Orlov --- diff --git a/ipatests/util.py b/ipatests/util.py index 24e149d..ea9ed80 100644 --- a/ipatests/util.py +++ b/ipatests/util.py @@ -69,8 +69,6 @@ if six.PY3: unicode = str -PYTEST_VERSION = tuple(int(v) for v in pytest.__version__.split('.')) - # settings are configured by conftest IPACLIENT_UNITTESTS = None SKIP_IPAAPI = None @@ -81,25 +79,14 @@ def check_ipaclient_unittests(reason="Skip in ipaclient unittest mode"): """Call this in a package to skip the package in ipaclient-unittest mode """ if IPACLIENT_UNITTESTS: - if PYTEST_VERSION[0] >= 3: - # pytest 3+ does no longer allow pytest.skip() on module level - # pylint: disable=unexpected-keyword-arg - raise pytest.skip.Exception(reason, allow_module_level=True) - # pylint: enable=unexpected-keyword-arg - else: - raise pytest.skip(reason) + pytest.skip(reason, allow_module_level=True) 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 SKIP_IPAAPI: - if PYTEST_VERSION[0] >= 3: - # pylint: disable=unexpected-keyword-arg - raise pytest.skip.Exception(reason, allow_module_level=True) - # pylint: enable=unexpected-keyword-arg - else: - raise pytest.skip(reason) + pytest.skip(reason, allow_module_level=True) class TempDir: