File: test_extra_links.py

package info (click to toggle)
sphinx-needs 5.1.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 11,924 kB
  • sloc: python: 21,132; javascript: 187; makefile: 89; sh: 29; xml: 10
file content (42 lines) | stat: -rw-r--r-- 1,170 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from pathlib import Path

import pytest


@pytest.mark.parametrize(
    "test_app",
    [{"buildername": "html", "srcdir": "doc_test/doc_extra_links"}],
    indirect=True,
)
def test_extra_links_html(test_app):
    app = test_app
    app.build()
    html = Path(app.outdir, "index.html").read_text()
    assert "TEST_001" in html
    assert "tested by" in html
    assert "tests" in html
    assert "blocked by" in html
    assert "blocks" in html

    # Check for correct dead_links handling
    assert '<span class="needs_dead_link">DEAD_LINK_ALLOWED</span>' in html
    assert (
        '<span class="needs_dead_link forbidden">DEAD_LINK_NOT_ALLOWED</span>' in html
    )
    assert '<span class="needs_dead_link forbidden">REQ_005.invalid</span>' in html


@pytest.mark.parametrize(
    "test_app",
    [{"buildername": "latex", "srcdir": "doc_test/doc_extra_links"}],
    indirect=True,
)
def test_extra_links_latex(test_app):
    app = test_app
    app.build()
    tex = Path(app.outdir, "needstestdocs.tex").read_text()
    assert "TEST_001" in tex
    assert "tested by" in tex
    assert "tests" in tex
    assert "blocked by" in tex
    assert "blocks" in tex