-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8573961
commit c4d8dc6
Showing
6 changed files
with
90 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
extensions = ["sphinx_needs"] | ||
|
||
needs_id_regex = "^[A-Za-z0-9_]" | ||
|
||
needs_types = [ | ||
{"directive": "req", "title": "Requirement", "prefix": "RQ_", "color": "#FEDCD2", "style": "node"}, | ||
{"directive": "spec", "title": "Specification", "prefix": "SP_", "color": "#FEDCD2", "style": "node"}, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
TEST DOCUMENT Needbar | ||
===================== | ||
|
||
.. req:: Req 1 | ||
:id: REQ_1 | ||
:tags: a | ||
|
||
.. req:: Req 2 | ||
:id: REQ_2 | ||
:tags: b | ||
|
||
.. req:: Req 3 | ||
:id: REQ_3 | ||
:tags: b | ||
|
||
.. spec:: Spec 1 | ||
:id: SPEC_1 | ||
:tags: a | ||
|
||
.. spec:: Spec 2 | ||
:id: SPEC_2 | ||
:tags: a | ||
|
||
.. spec:: Spec 3 | ||
:id: SPEC_3 | ||
:tags: b | ||
|
||
.. needbar:: Bar Title | ||
:legend: | ||
:xlabels: FROM_DATA | ||
:ylabels: FROM_DATA | ||
|
||
, A , B | ||
Req , type=='req' and 'a' in tags , type=='req' and 'a' in tags | ||
Spec , type=='spec' and 'b' in tags, type=='spec' and 'b' in tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
"""These tests should only be run in an environment without matplotlib installed.""" | ||
import pytest | ||
|
||
|
||
@pytest.mark.parametrize("test_app", [{"buildername": "html", "srcdir": "doc_test/doc_needbar"}], indirect=True) | ||
def test_needbar(test_app): | ||
"""Test the build fails correctly, if matplotlib is not installed.""" | ||
test_app.build() | ||
expected = "WARNING: Matplotlib is not installed and required by needbar. Install with `sphinx-needs[plotting]` to use. [needs.mpl]" | ||
assert expected in test_app._warning.getvalue() | ||
|
||
|
||
@pytest.mark.parametrize("test_app", [{"buildername": "html", "srcdir": "doc_test/doc_needpie"}], indirect=True) | ||
def test_needpie(test_app): | ||
"""Test the build fails correctly, if matplotlib is not installed.""" | ||
test_app.build() | ||
expected = "WARNING: Matplotlib is not installed and required by needpie. Install with `sphinx-needs[plotting]` to use. [needs.mpl]" | ||
assert expected in test_app._warning.getvalue() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from pathlib import Path | ||
|
||
import pytest | ||
|
||
|
||
@pytest.mark.parametrize("test_app", [{"buildername": "html", "srcdir": "doc_test/doc_needbar"}], indirect=True) | ||
def test_doc_build_html(test_app): | ||
app = test_app | ||
app.build() | ||
html = Path(app.outdir, "index.html").read_text() | ||
assert "SPEC_1" in html | ||
assert '<img alt="Bar Title"' in html |