diff options
author | Christian Heimes <cheimes@redhat.com> | 2017-01-03 18:08:05 +0100 |
---|---|---|
committer | Martin Basti <mbasti@redhat.com> | 2017-01-05 17:35:33 +0100 |
commit | 3387734e6c6d47a756b5e914e7e515d2610a424f (patch) | |
tree | 117beb9b9049f30e18865841f880f8f6ec34e8e9 | |
parent | 0ef55a91ef9c591cee3a7e1ff0e391cdc32423c3 (diff) | |
download | freeipa-3387734e6c6d47a756b5e914e7e515d2610a424f.tar.gz freeipa-3387734e6c6d47a756b5e914e7e515d2610a424f.tar.xz freeipa-3387734e6c6d47a756b5e914e7e515d2610a424f.zip |
Catch ValueError raised by pytest.config.getoption()
pytest.config.getoption() can raise ValueError for unknown options, too.
Reviewed-By: Milan Kubik <mkubik@redhat.com>
-rw-r--r-- | ipatests/test_util.py | 6 | ||||
-rw-r--r-- | ipatests/util.py | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/ipatests/test_util.py b/ipatests/test_util.py index 0fbd53620..f4e7773ca 100644 --- a/ipatests/test_util.py +++ b/ipatests/test_util.py @@ -140,8 +140,10 @@ class test_Fuzzy(object): def test_assert_deepequal(): f = util.assert_deepequal - # pylint: disable=no-member - pretty = pytest.config.getoption("pretty_print") + try: # pylint: disable=no-member + pretty = pytest.config.getoption("pretty_print") + except (AttributeError, ValueError): + pretty = False # LEN and KEYS formats use special function to pretty print structures # depending on a pytest environment settings diff --git a/ipatests/util.py b/ipatests/util.py index 7b5e317de..932038352 100644 --- a/ipatests/util.py +++ b/ipatests/util.py @@ -337,7 +337,7 @@ def assert_deepequal(expected, got, doc='', stack=tuple()): """ try: pretty_print = pytest.config.getoption("pretty_print") # pylint: disable=no-member - except AttributeError: + except (AttributeError, ValueError): pretty_print = False if pretty_print: |