Skip to content

Commit

Permalink
fix: emit a warning when no content is rendered
Browse files Browse the repository at this point in the history
Fixes pypa#149

Signed-off-by: Mike Fiedler <[email protected]>
  • Loading branch information
miketheman committed Mar 23, 2022
1 parent 7512742 commit 0889c59
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions readme_renderer/rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,5 @@ def render(
if rendered:
return clean(rendered)
else:
stream.write("no output rendered")
return None
10 changes: 10 additions & 0 deletions tests/test_rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,13 @@ def test_rst_raw():
""", stream=warnings) is None

assert '"raw" directive disabled' in warnings.getvalue()


def test_rst_header_only():
warnings = io.StringIO()
assert render("""
Header
======
""", stream=warnings) is None

assert "no output rendered" in warnings.getvalue()

0 comments on commit 0889c59

Please sign in to comment.