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 <slev@altlinux.org>
Reviewed-By: Sergey Orlov <sorlov@redhat.com>
This commit is contained in:
Stanislav Levin 2020-04-13 19:51:45 +03:00 committed by Sergey Orlov
parent f6b088effd
commit 18500a3d01
No known key found for this signature in database
GPG Key ID: ADF8C90EDD04503D

View File

@ -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: