From c0bc1e3e737f5015c531fdba5bb84a722bae39c0 Mon Sep 17 00:00:00 2001 From: Nicco Kunzmann Date: Sat, 21 Dec 2024 22:44:56 +0000 Subject: [PATCH] Print result of doctest failure --- src/icalendar/tests/test_with_doctest.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/icalendar/tests/test_with_doctest.py b/src/icalendar/tests/test_with_doctest.py index 1e8e511b..d2050d47 100644 --- a/src/icalendar/tests/test_with_doctest.py +++ b/src/icalendar/tests/test_with_doctest.py @@ -85,15 +85,15 @@ def test_documentation_file(document, zoneinfo_only, env_for_doctest, tzp): functions are also replaced to work. """ + try: + import pytz + except ImportError: + pytest.skip("pytz not installed, skipping this file.") try: # set raise_on_error to False if you wand to see the error for debug test_result = doctest.testfile( - document, module_relative=False, globs=env_for_doctest, raise_on_error=True + document, module_relative=False, globs=env_for_doctest, raise_on_error=False ) - except doctest.UnexpectedException as e: - ty, err, tb = e.exc_info - if issubclass(ty, ModuleNotFoundError) and err.name == "pytz": - pytest.skip("pytz not installed, skipping this file.") finally: tzp.use_zoneinfo() assert (