Use pytest conftest.py and drop pytest.ini

Let's replace some ugly hacks with proper pytest conftest.py hooks.
Test initialization of ipalib.api is now handled in
pytest_cmdline_main(). Pytest plugins, markers and ignores are also
moved into conftest.py. Additional guards make it possible to run tests
without ipaserver installed.

I added confcutdir to ensure that pytest does not leave our project
space. Pytest used pytest.ini or setup.py before but pytest.ini is gone.

Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Milan Kubik <mkubik@redhat.com>
This commit is contained in:
Christian Heimes
2017-01-03 18:04:53 +01:00
committed by Martin Basti
parent 3387734e6c
commit 1e06a5195b
8 changed files with 90 additions and 42 deletions

View File

@@ -949,10 +949,3 @@ def create_api(mode='dummy'):
return api
api = create_api(mode=None)
if os.environ.get('IPA_UNIT_TEST_MODE', None) == 'cli_test':
from ipalib.cli import cli_plugins
api.bootstrap(context='cli', in_server=False, in_tree=True, fallback=False)
for klass in cli_plugins:
api.add_plugin(klass)
api.finalize()