mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-23 15:40:01 -06:00
ipatests: Remove deprecated yield_fixture
'yield_fixture' is deprecated since Pytest3 [0]. FreeIPA requires at least 3.9.1. So, it can be safely removed. [0]: https://docs.pytest.org/en/latest/yieldfixture.html 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
ffb1db5616
commit
d67846fa36
@ -32,7 +32,6 @@ from pytest_multihost import make_multihost_fixture
|
||||
|
||||
from ipapython import ipautil
|
||||
from ipaplatform.paths import paths
|
||||
from ipatests.test_util import yield_fixture
|
||||
from .config import Config
|
||||
from .env_config import get_global_config
|
||||
from . import tasks
|
||||
@ -187,7 +186,7 @@ def class_integration_logs():
|
||||
return {}
|
||||
|
||||
|
||||
@yield_fixture
|
||||
@pytest.fixture
|
||||
def integration_logs(class_integration_logs, request):
|
||||
"""Provides access to test integration logs, and collects after each test
|
||||
"""
|
||||
@ -197,7 +196,7 @@ def integration_logs(class_integration_logs, request):
|
||||
collect_systemd_journal(request.node, hosts, request.config)
|
||||
|
||||
|
||||
@yield_fixture(scope='class')
|
||||
@pytest.fixture(scope='class')
|
||||
def mh(request, class_integration_logs):
|
||||
"""IPA's multihost fixture object
|
||||
"""
|
||||
|
@ -162,7 +162,7 @@ def restore_checker(host):
|
||||
assert_func(expected, got)
|
||||
|
||||
|
||||
@pytest.yield_fixture(scope="function")
|
||||
@pytest.fixture
|
||||
def cert_sign_request(request):
|
||||
master = request.instance.master
|
||||
hosts = [master] + request.instance.replicas
|
||||
|
@ -75,7 +75,7 @@ class TestSMB(IntegrationTest):
|
||||
for user in [cls.ipa_user1, cls.ipa_user2, cls.ad_user]:
|
||||
tasks.run_command_as_user(cls.smbserver, user, ['stat', '.'])
|
||||
|
||||
@pytest.yield_fixture
|
||||
@pytest.fixture
|
||||
def enable_smb_client_dns_lookup_kdc(self):
|
||||
smbclient = self.smbclient
|
||||
with tasks.FileBackup(smbclient, paths.KRB5_CONF):
|
||||
@ -86,7 +86,7 @@ class TestSMB(IntegrationTest):
|
||||
smbclient.put_file_contents(paths.KRB5_CONF, krb5_conf)
|
||||
yield
|
||||
|
||||
@pytest.yield_fixture
|
||||
@pytest.fixture
|
||||
def samba_share_public(self):
|
||||
"""Setup share outside /home on samba server."""
|
||||
share_name = 'shared'
|
||||
|
@ -13,10 +13,9 @@ import tempfile
|
||||
from ipalib import api
|
||||
|
||||
from ipaserver.install import installutils
|
||||
from ipatests.test_util import yield_fixture
|
||||
|
||||
|
||||
@yield_fixture()
|
||||
@pytest.fixture
|
||||
def keytab():
|
||||
fd, keytab_path = tempfile.mkstemp(suffix='.keytab')
|
||||
os.close(fd)
|
||||
|
@ -33,19 +33,6 @@ if six.PY3:
|
||||
unicode = str
|
||||
|
||||
pytestmark = pytest.mark.tier0
|
||||
|
||||
|
||||
# pytest >= 2.10 supports yield based fixtures with pytest.fixture. In
|
||||
# pytest < 2.10 pytest.yield_fixture is required. But that function
|
||||
# also raises a deprecation warning in pytest >= 3.0.
|
||||
PYTEST_VERSION = tuple(int(p) for p in pytest.__version__.split('.'))
|
||||
|
||||
if PYTEST_VERSION < (2, 10):
|
||||
yield_fixture = pytest.yield_fixture
|
||||
else:
|
||||
yield_fixture = pytest.fixture
|
||||
|
||||
|
||||
pattern_type = type(re.compile(""))
|
||||
|
||||
|
||||
|
@ -24,7 +24,6 @@ from cryptography.hazmat.primitives.asymmetric import rsa
|
||||
from cryptography.x509.oid import NameOID
|
||||
|
||||
from ipalib import api, errors
|
||||
from ipatests.test_util import yield_fixture
|
||||
from ipatests.test_xmlrpc.tracker.host_plugin import HostTracker
|
||||
from ipatests.test_xmlrpc.tracker.user_plugin import UserTracker
|
||||
from ipatests.test_xmlrpc.xmlrpc_test import XMLRPC_test
|
||||
@ -79,41 +78,41 @@ def _record_setup(host, zone, record, **kwargs):
|
||||
host.run_command('dnsrecord_del', zone, record, **kwargs)
|
||||
|
||||
|
||||
@yield_fixture(scope='class')
|
||||
@pytest.fixture(scope='class')
|
||||
def ipv4_revzone(host):
|
||||
yield from _zone_setup(host, ipv4_revzone_s)
|
||||
|
||||
|
||||
@yield_fixture(scope='class')
|
||||
@pytest.fixture(scope='class')
|
||||
def ipv6_revzone(host):
|
||||
yield from _zone_setup(host, ipv6_revzone_s)
|
||||
|
||||
|
||||
@yield_fixture(scope='class')
|
||||
@pytest.fixture(scope='class')
|
||||
def ipv4_ptr(host, ipv4_revzone):
|
||||
yield from _record_setup(
|
||||
host, ipv4_revzone, ipv4_revrec_s, ptrrecord=host_ptr)
|
||||
|
||||
|
||||
@yield_fixture(scope='class')
|
||||
@pytest.fixture(scope='class')
|
||||
def ipv6_ptr(host, ipv6_revzone):
|
||||
yield from _record_setup(
|
||||
host, ipv6_revzone, ipv6_revrec_s, ptrrecord=host_ptr)
|
||||
|
||||
|
||||
@yield_fixture(scope='class')
|
||||
@pytest.fixture(scope='class')
|
||||
def ipv4_a(host):
|
||||
yield from _record_setup(
|
||||
host, api.env.domain, 'iptest', arecord=ipv4_address)
|
||||
|
||||
|
||||
@yield_fixture(scope='class')
|
||||
@pytest.fixture(scope='class')
|
||||
def ipv6_aaaa(host):
|
||||
yield from _record_setup(
|
||||
host, api.env.domain, 'iptest', aaaarecord=ipv6_address)
|
||||
|
||||
|
||||
@yield_fixture(scope='class')
|
||||
@pytest.fixture(scope='class')
|
||||
def other_forward_records(host):
|
||||
"""
|
||||
Create A and AAAA records (to the "correct" IP address) for
|
||||
@ -125,19 +124,19 @@ def other_forward_records(host):
|
||||
arecord=ipv4_address, aaaarecord=ipv6_address)
|
||||
|
||||
|
||||
@yield_fixture(scope='function')
|
||||
@pytest.fixture(scope='function')
|
||||
def ipv4_ptr_other(host, ipv4_revzone):
|
||||
yield from _record_setup(
|
||||
host, ipv4_revzone, ipv4_revrec_s, ptrrecord=other_ptr)
|
||||
|
||||
|
||||
@yield_fixture(scope='class')
|
||||
@pytest.fixture(scope='class')
|
||||
def cname1(host):
|
||||
yield from _record_setup(
|
||||
host, api.env.domain, 'cname1', cnamerecord='iptest')
|
||||
|
||||
|
||||
@yield_fixture(scope='class')
|
||||
@pytest.fixture(scope='class')
|
||||
def cname2(host):
|
||||
yield from _record_setup(
|
||||
host, api.env.domain, 'cname2', cnamerecord='cname1')
|
||||
|
@ -36,7 +36,6 @@ from ipaplatform.paths import paths
|
||||
from ipapython import ipautil
|
||||
from ipapython.dn import DN
|
||||
from ipapython.dnsutil import DNSName
|
||||
from ipatests.test_util import yield_fixture
|
||||
from ipatests.test_xmlrpc import objectclasses
|
||||
from ipatests.test_xmlrpc.test_user_plugin import get_group_dn
|
||||
from ipatests.test_xmlrpc.testcert import get_testcert, subject_base
|
||||
@ -643,7 +642,7 @@ class TestValidation(XMLRPC_test):
|
||||
), result)
|
||||
|
||||
|
||||
@yield_fixture
|
||||
@pytest.fixture
|
||||
def keytabname(request):
|
||||
keytabfd, keytabname = tempfile.mkstemp()
|
||||
try:
|
||||
@ -727,7 +726,7 @@ class TestHostFalsePwdChange(XMLRPC_test):
|
||||
command()
|
||||
|
||||
|
||||
@yield_fixture(scope='class')
|
||||
@pytest.fixture(scope='class')
|
||||
def dns_setup_nonameserver(host4):
|
||||
# Make sure that the server does not handle the reverse zone used
|
||||
# for the test
|
||||
@ -819,7 +818,7 @@ class TestHostNoNameserversForRevZone(XMLRPC_test):
|
||||
pass
|
||||
|
||||
|
||||
@yield_fixture(scope='class')
|
||||
@pytest.fixture(scope='class')
|
||||
def dns_setup(host):
|
||||
try:
|
||||
host.run_command('dnszone_del', dnszone, revzone, revipv6zone,
|
||||
|
@ -12,7 +12,6 @@ from ipalib import errors, api
|
||||
from ipapython import ipautil
|
||||
from ipaplatform.paths import paths
|
||||
|
||||
from ipatests.test_util import yield_fixture
|
||||
from ipatests.util import MockLDAP
|
||||
from ipatests.test_xmlrpc.xmlrpc_test import XMLRPC_test
|
||||
from ipatests.test_xmlrpc.tracker.user_plugin import UserTracker
|
||||
@ -51,7 +50,7 @@ TRACKER_DATA = [
|
||||
]
|
||||
|
||||
|
||||
@yield_fixture
|
||||
@pytest.fixture
|
||||
def trusted_domain():
|
||||
"""Fixture providing mocked AD trust entries
|
||||
|
||||
@ -69,7 +68,7 @@ def trusted_domain():
|
||||
ldap.del_entry(trusted_dom['dn'])
|
||||
|
||||
|
||||
@yield_fixture
|
||||
@pytest.fixture
|
||||
def trusted_domain_with_suffix():
|
||||
"""Fixture providing mocked AD trust entries
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user