Catch ValueError raised by pytest.config.getoption()

pytest.config.getoption() can raise ValueError for unknown options, too.

Reviewed-By: Milan Kubik <mkubik@redhat.com>
This commit is contained in:
Christian Heimes authored and Martin Basti committed 2017-01-05 17:35:33 +01:00
1 parent 0ef55a91ef
commit 3387734e6c
2 files changed
+5 -3

No files matched your search

+4 -2
View File
@@ -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
+1 -1
View File
@@ -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: