mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
pytest: Migrate xunit-style setups to Pytest fixtures
Even though Pytest supports xunit style setups, unittest and nose tests, this support is limited and may be dropped in the future releases. Worst of all is that the mixing of various test frameworks results in weird conflicts and of course, is not widely tested. This is a part of work to remove the mixing of test idioms in the IPA's test suite: 1) replace xunit style 2) employ the fixtures' interdependencies Related: https://pagure.io/freeipa/issue/7989 Signed-off-by: Stanislav Levin <slev@altlinux.org> Reviewed-By: Christian Heimes <cheimes@redhat.com>
This commit is contained in:
committed by
Alexander Bokovoy
parent
ff547a2777
commit
292d686c0b
@@ -86,7 +86,8 @@ def test_ip_address(addr, words, prefixlen):
|
||||
|
||||
|
||||
class TestCIDict:
|
||||
def setup(self):
|
||||
@pytest.fixture(autouse=True)
|
||||
def cidict_setup(self):
|
||||
self.cidict = ipautil.CIDict()
|
||||
self.cidict["Key1"] = "val1"
|
||||
self.cidict["key2"] = "val2"
|
||||
|
||||
@@ -41,7 +41,8 @@ class test_keyring:
|
||||
Test the kernel keyring interface
|
||||
"""
|
||||
|
||||
def setup(self):
|
||||
@pytest.fixture(autouse=True)
|
||||
def keyring_setup(self):
|
||||
try:
|
||||
kernel_keyring.del_key(TEST_KEY)
|
||||
except ValueError:
|
||||
|
||||
@@ -17,7 +17,8 @@ class test_session_storage:
|
||||
Test the session storage interface
|
||||
"""
|
||||
|
||||
def setup(self):
|
||||
@pytest.fixture(autouse=True)
|
||||
def session_storage_setup(self):
|
||||
# TODO: set up test user and kinit to it
|
||||
# tmpdir = tempfile.mkdtemp(prefix = "tmp-")
|
||||
# os.environ['KRB5CCNAME'] = 'FILE:%s/ccache' % tmpdir
|
||||
|
||||
Reference in New Issue
Block a user