Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions tests/doc_test/with_missing_image/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"""Configuration for testing missing image warnings."""

project = "MissingImageTest"
extensions = ["sphinx_simplepdf"]
master_doc = "index"
exclude_patterns = ["_build"]

simplepdf_theme = "simplepdf_theme"
9 changes: 9 additions & 0 deletions tests/doc_test/with_missing_image/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Document with Missing Image
===========================

This document references an image that does not exist.

.. image:: _static/nonexistent_image.png
:alt: This image does not exist

Content after the missing image.
1 change: 0 additions & 1 deletion tests/test_basic_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ def test_basic_build_succeeds(sphinx_build, capsys):
result = build_and_capture_stdout(sphinx_build, capsys, srcdir="basic_doc")

assert result.pdf_exists()
# assert not result.has_warnings()
assert not result.has_warnings("ERROR:")


Expand Down
9 changes: 6 additions & 3 deletions tests/test_warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ def test_broken_anchors_warning(sphinx_build, capsys):
assert len(anchor_warnings) > 0


def test_missing_image_warning(sphinx_build, tmp_path):
def test_missing_image_warning(sphinx_build, capsys):
"""Test that missing images produce warnings."""
# This would require a test doc with broken image reference
pytest.skip("Requires test doc with broken image")
result = build_and_capture_stdout(sphinx_build, capsys, srcdir="with_missing_image")

assert result.has_warnings()
image_warnings = result.get_warnings_matching(r"(image|nonexistent|not found|not readable)")
assert len(image_warnings) > 0


def test_build_warnings_are_captured(sphinx_build, capsys):
Expand Down
Loading