Skip to content

Commit

Permalink
builder: add test showing that only directive works for ignoring blocks
Browse files Browse the repository at this point in the history
Add a test showing that the `only` directive works for ignoring
sections of content that has content that should not be checked.

Addresses sphinx-contrib#204
  • Loading branch information
dhellmann committed Feb 18, 2023
1 parent c7110a6 commit 7424103
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/test_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,3 +543,28 @@ def test_domain_ignore_output(sphinx_project):
output_text = None

assert output_text == "The Module\n**********\n\nteh is OK\n"


def test_only_directive(sphinx_project):
# How to skip checking nested blocks of content
# https://github.com/sphinx-contrib/spelling/issues/204
srcdir, outdir = sphinx_project

add_file(srcdir, 'contents.rst', '''
The Module
==========
.. only:: html
teh is ok
whaat is not ok
''')

stdout, stderr, output_text = get_sphinx_output(
srcdir,
outdir,
'contents',
)
assert '(whaat)' in output_text
assert '(teh)' not in output_text

0 comments on commit 7424103

Please sign in to comment.