summaryrefslogtreecommitdiffstats
path: root/ipatests
diff options
context:
space:
mode:
authorMilan KubĂ­k <mkubik@redhat.com>2016-10-21 14:29:50 +0200
committerMartin Basti <mbasti@redhat.com>2016-11-14 18:19:17 +0100
commite54109c167526ae6b1cd4c977915da884482891b (patch)
treecd04180546475c79d4ed5e57a6e23045b8200125 /ipatests
parent2df709838905dec3ee2c2eaec47f506336d85a6e (diff)
downloadfreeipa-e54109c167526ae6b1cd4c977915da884482891b.tar.gz
freeipa-e54109c167526ae6b1cd4c977915da884482891b.tar.xz
freeipa-e54109c167526ae6b1cd4c977915da884482891b.zip
ipatests: Fix assert_deepequal outside of pytest process
https://fedorahosted.org/freeipa/ticket/6420 Reviewed-By: Martin Basti <mbasti@redhat.com>
Diffstat (limited to 'ipatests')
-rw-r--r--ipatests/util.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/ipatests/util.py b/ipatests/util.py
index 889e85050..bca8e9c1e 100644
--- a/ipatests/util.py
+++ b/ipatests/util.py
@@ -330,7 +330,12 @@ def assert_deepequal(expected, got, doc='', stack=tuple()):
Note that lists and tuples are considered equivalent, and the order of
their elements does not matter.
"""
- if pytest.config.getoption("pretty_print"): # pylint: disable=no-member
+ try:
+ pretty_print = pytest.config.getoption("pretty_print") # pylint: disable=no-member
+ except AttributeError:
+ pretty_print = False
+
+ if pretty_print:
expected_str = struct_to_string(expected, EXPECTED_LEN)
got_str = struct_to_string(got, GOT_LEN)
else: