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
2017-01-03 18:08:05 +01:00
committed by Martin Basti
parent 0ef55a91ef
commit 3387734e6c
2 changed files with 5 additions and 3 deletions

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