summaryrefslogtreecommitdiff
path: root/tests/test_ext_todo.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_ext_todo.py')
-rw-r--r--tests/test_ext_todo.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/tests/test_ext_todo.py b/tests/test_ext_todo.py
index 4f01a07ab..0260b821d 100644
--- a/tests/test_ext_todo.py
+++ b/tests/test_ext_todo.py
@@ -5,7 +5,7 @@
Test sphinx.ext.todo extension.
- :copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS.
+ :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -85,8 +85,9 @@ def test_todo_not_included(app, status, warning):
assert len(todos) == 2
assert set(todo[1].astext() for todo in todos) == set(['todo in foo', 'todo in bar'])
+
@pytest.mark.sphinx('latex', testroot='ext-todo', freshenv=True,
- confoverrides={'todo_include_todos': True, 'todo_emit_warnings': True})
+ confoverrides={'todo_include_todos': True})
def test_todo_valid_link(app, status, warning):
"""
Test that the inserted "original entry" links for todo items have a target
@@ -99,16 +100,17 @@ def test_todo_valid_link(app, status, warning):
content = (app.outdir / 'TodoTests.tex').text()
- # Look for the link to foo. We could equally well look for the link to bar.
+ # Look for the link to foo. Note that there are two of them because the
+ # source document uses todolist twice. We could equally well look for links
+ # to bar.
link = r'\{\\hyperref\[\\detokenize\{(.*?foo.*?)}]\{\\sphinxcrossref{' \
r'\\sphinxstyleemphasis{original entry}}}}'
m = re.findall(link, content)
- assert len(m) == 1
+ assert len(m) == 2
target = m[0]
# Look for the targets of this link.
- labels = [m for m in re.findall(r'\\label\{([^}]*)}', content)
- if m == target]
+ labels = [m for m in re.findall(r'\\label\{([^}]*)}', content) if m == target]
# If everything is correct we should have exactly one target.
assert len(labels) == 1