1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# Copyright (C) 2017 FreeIPA Contributors see COPYING for license
import importlib
import pkg_resources
import pytest
@pytest.mark.parametrize("modname", [
# placeholder packages raise ImportError
'ipaserver',
'ipatests',
# PyPI packages do not have install subpackage
'ipaclient.install',
'ipalib.install',
'ipapython.install',
# override module should not be shipped in wheels
'ipaplatform.override',
])
def test_fail_import(modname):
try:
importlib.import_module(modname)
except ImportError:
pass
else:
pytest.fail("'import {}' does not fail".format(modname))
@pytest.mark.parametrize("modname", [
'ipaclient',
'ipalib',
'ipaplatform',
'ipapython',
])
def test_import(modname):
importlib.import_module(modname)
@pytest.mark.parametrize("pkgname", [
'ipaclient',
'ipalib',
'ipaplatform',
'ipapython',
'ipaserver',
'ipatests',
])
def test_package_installed(pkgname):
pkg_resources.require(pkgname)
|