diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2018-01-28 00:18:33 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2018-01-28 00:18:33 +0900 |
commit | af25fa123d2d2cf0ea8073b61120f5205f07deb8 (patch) | |
tree | 8c94fcdb0b30527b68bc2c33918655e5f3b05d1a /tests | |
parent | 6897b80fc4357ef99d2f5398d872f35e06c15af6 (diff) | |
parent | b6efff799069666d035932f1b413ae58627a1375 (diff) | |
download | sphinx-git-af25fa123d2d2cf0ea8073b61120f5205f07deb8.tar.gz |
Merge branch 'stable' into 1.7-release
Diffstat (limited to 'tests')
-rw-r--r-- | tests/roots/test-apidoc-pep420/a/b/e/__init__.py | 0 | ||||
-rw-r--r-- | tests/roots/test-apidoc-pep420/a/b/e/f.py | 1 | ||||
-rw-r--r-- | tests/test_ext_apidoc.py | 60 |
3 files changed, 61 insertions, 0 deletions
diff --git a/tests/roots/test-apidoc-pep420/a/b/e/__init__.py b/tests/roots/test-apidoc-pep420/a/b/e/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/roots/test-apidoc-pep420/a/b/e/__init__.py diff --git a/tests/roots/test-apidoc-pep420/a/b/e/f.py b/tests/roots/test-apidoc-pep420/a/b/e/f.py new file mode 100644 index 000000000..a09affe86 --- /dev/null +++ b/tests/roots/test-apidoc-pep420/a/b/e/f.py @@ -0,0 +1 @@ +"Module f" diff --git a/tests/test_ext_apidoc.py b/tests/test_ext_apidoc.py index 2bfc8016e..8a60816bd 100644 --- a/tests/test_ext_apidoc.py +++ b/tests/test_ext_apidoc.py @@ -67,6 +67,7 @@ def test_pep_0420_enabled(make_app, apidoc): outdir = apidoc.outdir assert (outdir / 'conf.py').isfile() assert (outdir / 'a.b.c.rst').isfile() + assert (outdir / 'a.b.e.rst').isfile() assert (outdir / 'a.b.x.rst').isfile() with open(outdir / 'a.b.c.rst') as f: @@ -74,6 +75,10 @@ def test_pep_0420_enabled(make_app, apidoc): assert "automodule:: a.b.c.d\n" in rst assert "automodule:: a.b.c\n" in rst + with open(outdir / 'a.b.e.rst') as f: + rst = f.read() + assert "automodule:: a.b.e.f\n" in rst + with open(outdir / 'a.b.x.rst') as f: rst = f.read() assert "automodule:: a.b.x.y\n" in rst @@ -86,12 +91,67 @@ def test_pep_0420_enabled(make_app, apidoc): builddir = outdir / '_build' / 'text' assert (builddir / 'a.b.c.txt').isfile() + assert (builddir / 'a.b.e.txt').isfile() + assert (builddir / 'a.b.x.txt').isfile() + + with open(builddir / 'a.b.c.txt') as f: + txt = f.read() + assert "a.b.c package\n" in txt + + with open(builddir / 'a.b.e.txt') as f: + txt = f.read() + assert "a.b.e.f module\n" in txt + + with open(builddir / 'a.b.x.txt') as f: + txt = f.read() + assert "a.b.x namespace\n" in txt + + +@pytest.mark.apidoc( + coderoot='test-apidoc-pep420/a', + options=["--implicit-namespaces", "--separate"], +) +def test_pep_0420_enabled_separate(make_app, apidoc): + outdir = apidoc.outdir + assert (outdir / 'conf.py').isfile() + assert (outdir / 'a.b.c.rst').isfile() + assert (outdir / 'a.b.e.rst').isfile() + assert (outdir / 'a.b.e.f.rst').isfile() + assert (outdir / 'a.b.x.rst').isfile() + assert (outdir / 'a.b.x.y.rst').isfile() + + with open(outdir / 'a.b.c.rst') as f: + rst = f.read() + assert ".. toctree::\n\n a.b.c.d\n" in rst + + with open(outdir / 'a.b.e.rst') as f: + rst = f.read() + assert ".. toctree::\n\n a.b.e.f\n" in rst + + with open(outdir / 'a.b.x.rst') as f: + rst = f.read() + assert ".. toctree::\n\n a.b.x.y\n" in rst + + app = make_app('text', srcdir=outdir) + app.build() + print(app._status.getvalue()) + print(app._warning.getvalue()) + + builddir = outdir / '_build' / 'text' + assert (builddir / 'a.b.c.txt').isfile() + assert (builddir / 'a.b.e.txt').isfile() + assert (builddir / 'a.b.e.f.txt').isfile() assert (builddir / 'a.b.x.txt').isfile() + assert (builddir / 'a.b.x.y.txt').isfile() with open(builddir / 'a.b.c.txt') as f: txt = f.read() assert "a.b.c package\n" in txt + with open(builddir / 'a.b.e.f.txt') as f: + txt = f.read() + assert "a.b.e.f module\n" in txt + with open(builddir / 'a.b.x.txt') as f: txt = f.read() assert "a.b.x namespace\n" in txt |