ipatests: Remove no longer needed 'get_marker'

'get_marker' was a compat shim for Pytest < 3.6.
Since the requred Pytest is 3.9.1+, the workaround 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:34:00 +03:00 committed by Sergey Orlov
parent d67846fa36
commit be6ac7d4c9
No known key found for this signature in database
GPG Key ID: ADF8C90EDD04503D

View File

@ -137,17 +137,11 @@ def pytest_cmdline_main(config):
def pytest_runtest_setup(item):
if isinstance(item, pytest.Function):
# pytest 3.6 has deprecated get_marker in 3.6. The method was
# removed in 4.x and replaced with get_closest_marker.
if hasattr(item, 'get_closest_marker'):
get_marker = item.get_closest_marker # pylint: disable=no-member
else:
get_marker = item.get_marker # pylint: disable=no-member
if get_marker('skip_ipaclient_unittest'):
if item.get_closest_marker('skip_ipaclient_unittest'):
# pylint: disable=no-member
if item.config.option.ipaclient_unittests:
pytest.skip("Skip in ipaclient unittest mode")
if get_marker('needs_ipaapi'):
if item.get_closest_marker('needs_ipaapi'):
# pylint: disable=no-member
if item.config.option.skip_ipaapi:
pytest.skip("Skip tests that needs an IPA API")