Skip to content

Commit

Permalink
test_ldap: Do not uses pytest fixtures as functions
Browse files Browse the repository at this point in the history
test_ldap.py::test_local_negative_timeout_enabled_by_default
  /usr/lib/python3.7/site-packages/_pytest/fixtures.py:827:
    RemovedInPytest4Warning: Fixture "passwd_ops_setup" called directly.
    Fixtures are not meant to be called directly, are created
    automatically when test functions request them as parameters. See
    https://docs.pytest.org/en/latest/fixture.html for more information.
    res = fixturefunc(**kwargs)
  /usr/lib/python3.7/site-packages/_pytest/fixtures.py:827:
    RemovedInPytest4Warning: Fixture "group_ops_setup" called directly.
    Fixtures are not meant to be called directly, are created
    automatically when test functions request them as parameters. See
    https://docs.pytest.org/en/latest/fixture.html for more information.
    res = fixturefunc(**kwargs)
  /usr/lib/python3.7/site-packages/_pytest/fixtures.py:827:
    RemovedInPytest4Warning: Fixture "user_and_group_rfc2307" called directly.
    Fixtures are not meant to be called directly, are created
    automatically when test functions request them as parameters. See
    https://docs.pytest.org/en/latest/fixture.html for more information.

Resolves:
https://pagure.io/SSSD/sssd/issue/3942

Merges: https://pagure.io/SSSD/sssd/pull-request/3953

Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
(cherry picked from commit 948cd08)
  • Loading branch information
Lukas Slebodnik authored and jhrozek committed Feb 26, 2019
1 parent 2805121 commit 0fb6543
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/tests/intg/test_ldap.py
Expand Up @@ -1596,13 +1596,14 @@ def test_rename_incomplete_group_rdn_changed(ldap_conn, rename_setup_cleanup):


@pytest.fixture
def user_and_group_rfc2307_lcl(request, ldap_conn):
pwd_ops = passwd_ops_setup(request)
def user_and_group_rfc2307_lcl(passwd_ops_setup, group_ops_setup,
user_and_group_rfc2307):
pwd_ops = passwd_ops_setup
pwd_ops.useradd(**PASSWD_USER)
grp_ops = group_ops_setup(request)
grp_ops = group_ops_setup
grp_ops.groupadd(**PASSWD_GROUP)

return user_and_group_rfc2307(request, ldap_conn)
return user_and_group_rfc2307


def test_local_negative_timeout_enabled_by_default(ldap_conn,
Expand Down Expand Up @@ -1660,15 +1661,16 @@ def test_local_negative_timeout_enabled_by_default(ldap_conn,


@pytest.fixture
def usr_and_grp_rfc2307_no_local_ncache(request, ldap_conn):
def usr_and_grp_rfc2307_no_local_ncache(request, passwd_ops_setup,
group_ops_setup, ldap_conn):
"""
Create an RFC2307 directory fixture with interactive SSSD conf,
one user and one group but with the local negative timeout
disabled
"""
pwd_ops = passwd_ops_setup(request)
pwd_ops = passwd_ops_setup
pwd_ops.useradd(**PASSWD_USER)
grp_ops = group_ops_setup(request)
grp_ops = group_ops_setup
grp_ops.groupadd(**PASSWD_GROUP)

ent_list = ldap_ent.List(ldap_conn.ds_inst.base_dn)
Expand Down

0 comments on commit 0fb6543

Please sign in to comment.