mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
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:
parent
f6b088effd
commit
18500a3d01
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user