Skip to content

Commit

Permalink
Merge pull request #760 from niccokunzmann/print-doctest-failure
Browse files Browse the repository at this point in the history
Print result of doctest failure
  • Loading branch information
niccokunzmann authored Dec 22, 2024
2 parents 4725c1b + bdc425d commit 9a77093
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Changelog
Minor changes:

- Add a ``weekday`` attribute to ``vWeekday`` components. See `Issue 749 <https://github.com/collective/icalendar/issues/749>`_.
- Print failure of doctest to aid debugging.

Breaking changes:

Expand Down
10 changes: 5 additions & 5 deletions src/icalendar/tests/test_with_doctest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down

0 comments on commit 9a77093

Please sign in to comment.