67
67
68
68
PYTEST_VERSION = tuple (int (v ) for v in pytest .__version__ .split ('.' ))
69
69
70
+ # settings are configured by conftest
71
+ IPACLIENT_UNITTESTS = None
72
+ SKIP_IPAAPI = None
73
+ PRETTY_PRINT = None
74
+
70
75
71
76
def check_ipaclient_unittests (reason = "Skip in ipaclient unittest mode" ):
72
77
"""Call this in a package to skip the package in ipaclient-unittest mode
73
78
"""
74
- config = pytest .config # pylint: disable=no-member
75
- if config .getoption ('ipaclient_unittests' , False ):
79
+ if IPACLIENT_UNITTESTS :
76
80
if PYTEST_VERSION [0 ] >= 3 :
77
81
# pytest 3+ does no longer allow pytest.skip() on module level
78
82
# pylint: disable=unexpected-keyword-arg
@@ -85,8 +89,7 @@ def check_ipaclient_unittests(reason="Skip in ipaclient unittest mode"):
85
89
def check_no_ipaapi (reason = "Skip tests that needs an IPA API" ):
86
90
"""Call this in a package to skip the package in no-ipaapi mode
87
91
"""
88
- config = pytest .config # pylint: disable=no-member
89
- if config .getoption ('skip_ipaapi' , False ):
92
+ if SKIP_IPAAPI :
90
93
if PYTEST_VERSION [0 ] >= 3 :
91
94
# pylint: disable=unexpected-keyword-arg
92
95
raise pytest .skip .Exception (reason , allow_module_level = True )
@@ -384,12 +387,7 @@ def assert_deepequal(expected, got, doc='', stack=tuple()):
384
387
Note that lists and tuples are considered equivalent, and the order of
385
388
their elements does not matter.
386
389
"""
387
- try :
388
- pretty_print = pytest .config .getoption ("pretty_print" )
389
- except (AttributeError , ValueError ):
390
- pretty_print = False
391
-
392
- if pretty_print :
390
+ if PRETTY_PRINT :
393
391
expected_str = struct_to_string (expected , EXPECTED_LEN )
394
392
got_str = struct_to_string (got , GOT_LEN )
395
393
else :
0 commit comments