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
@@ -9,6 +9,8 @@ from abc import ABCMeta, abstractproperty
|
||||
from collections import namedtuple
|
||||
import itertools
|
||||
|
||||
import pytest
|
||||
|
||||
from ipatests.util import assert_equal
|
||||
from ipaserver.install.ipa_replica_install import ReplicaInstall
|
||||
|
||||
@@ -23,16 +25,18 @@ class InstallerTestBase(six.with_metaclass(ABCMeta, object)):
|
||||
def tested_cls(self):
|
||||
return None
|
||||
|
||||
def setup_class(self):
|
||||
@pytest.fixture(autouse=True, scope="class")
|
||||
def installer_setup(self, request):
|
||||
"""Initializes the tested class so that it can be used later on
|
||||
"""
|
||||
self.tested_cls.make_parser()
|
||||
cls = request.cls
|
||||
cls.tested_cls.make_parser()
|
||||
assert \
|
||||
getattr(self.tested_cls, 'option_parser', False), \
|
||||
getattr(cls.tested_cls, 'option_parser', False), \
|
||||
("Unable to generate option parser for {}"
|
||||
.format(self.tested_cls.__name__))
|
||||
.format(cls.tested_cls.__name__))
|
||||
|
||||
self._populate_opts_dict()
|
||||
cls._populate_opts_dict()
|
||||
|
||||
@classmethod
|
||||
def _populate_opts_dict(cls):
|
||||
|
||||
Reference in New Issue
Block a user