summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2019-02-03 22:10:43 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2019-02-14 02:20:55 +0900
commit891178e8ed6cde1b7bf3048ca73b784caf96e010 (patch)
tree52784bb45ac30de56b1cd758757f14f18cbf8ab6
parent973fbb81e48f1574741c9babebd5d8b7a036e8cb (diff)
downloadsphinx-git-891178e8ed6cde1b7bf3048ca73b784caf96e010.tar.gz
test: Reduce warnings on building test-root
Note: all warnings are tested on test-warnings.
-rw-r--r--tests/roots/test-root/autodoc.txt8
-rw-r--r--tests/roots/test-root/autodoc_fodder.py7
-rw-r--r--tests/roots/test-root/images.txt3
-rw-r--r--tests/roots/test-root/includes.txt1
-rw-r--r--tests/roots/test-root/subdir/include.inc2
-rw-r--r--tests/test_builder.py34
-rw-r--r--tests/test_environment.py2
-rw-r--r--tests/test_ext_apidoc.py2
8 files changed, 14 insertions, 45 deletions
diff --git a/tests/roots/test-root/autodoc.txt b/tests/roots/test-root/autodoc.txt
index 39d9dd5a7..959ab2d67 100644
--- a/tests/roots/test-root/autodoc.txt
+++ b/tests/roots/test-root/autodoc.txt
@@ -3,8 +3,6 @@ Autodoc tests
Just testing a few autodoc possibilities...
-.. automodule:: util
-
.. automodule:: autodoc_target
:members:
@@ -28,12 +26,6 @@ Just testing a few autodoc possibilities...
:members:
-.. automodule:: autodoc_fodder
- :noindex:
-
- .. autoclass:: MarkupError
-
-
.. currentmodule:: autodoc_target
.. autoclass:: InstAttCls
diff --git a/tests/roots/test-root/autodoc_fodder.py b/tests/roots/test-root/autodoc_fodder.py
deleted file mode 100644
index e5fd74139..000000000
--- a/tests/roots/test-root/autodoc_fodder.py
+++ /dev/null
@@ -1,7 +0,0 @@
-
-class MarkupError(object):
- """
- .. note:: This is a docstring with a
- small markup error which should have
- correct location information.
- """
diff --git a/tests/roots/test-root/images.txt b/tests/roots/test-root/images.txt
index 55bc6f61c..1dc591a02 100644
--- a/tests/roots/test-root/images.txt
+++ b/tests/roots/test-root/images.txt
@@ -4,9 +4,6 @@ Sphinx image handling
.. first, a simple test with direct filename
.. image:: img.png
-.. a non-existing image with direct filename
-.. image:: foo.png
-
.. an image with path name (relative to this directory!)
.. image:: subdir/img.png
:height: 100
diff --git a/tests/roots/test-root/includes.txt b/tests/roots/test-root/includes.txt
index e921a966c..5deec9864 100644
--- a/tests/roots/test-root/includes.txt
+++ b/tests/roots/test-root/includes.txt
@@ -3,7 +3,6 @@ Testing downloadable files
Download :download:`img.png` here.
Download :download:`this <subdir/img.png>` there.
-Don't download :download:`this <nonexisting.png>`.
Test file and literal inclusion
===============================
diff --git a/tests/roots/test-root/subdir/include.inc b/tests/roots/test-root/subdir/include.inc
index 1211300c2..d89275d1d 100644
--- a/tests/roots/test-root/subdir/include.inc
+++ b/tests/roots/test-root/subdir/include.inc
@@ -2,4 +2,4 @@
.. Paths in included files are relative to the file that
includes them
-.. image:: ../root/img.png
+.. image:: subdir/img.png
diff --git a/tests/test_builder.py b/tests/test_builder.py
index 09c64ab86..35197a8ef 100644
--- a/tests/test_builder.py
+++ b/tests/test_builder.py
@@ -10,11 +10,12 @@
import pytest
-@pytest.mark.sphinx('dummy', srcdir="test_builder")
+@pytest.mark.sphinx('dummy', srcdir="test_builder", freshenv=True)
def test_incremental_reading(app):
# first reading
updated = app.builder.read()
assert set(updated) == app.env.found_docs == set(app.env.all_docs)
+ assert updated == sorted(updated) # sorted by alphanumeric
# test if exclude_patterns works ok
assert 'subdir/excluded' not in app.env.found_docs
@@ -27,29 +28,20 @@ def test_incremental_reading(app):
# second reading
updated = app.builder.read()
- # "includes" and "images" are in there because they contain references
- # to nonexisting downloadable or image files, which are given another
- # chance to exist
- assert set(updated) == set(['index', 'new', 'includes', 'images'])
+ assert set(updated) == set(['index', 'new'])
assert 'autodoc' not in app.env.all_docs
assert 'autodoc' not in app.env.found_docs
-@pytest.mark.sphinx('dummy')
-def test_env_read_docs(app):
- """By default, docnames are read in alphanumeric order"""
- def on_env_read_docs_1(app, env, docnames):
- pass
-
- app.connect('env-before-read-docs', on_env_read_docs_1)
-
- read_docnames = app.builder.read()
- assert len(read_docnames) > 2 and read_docnames == sorted(read_docnames)
-
- def on_env_read_docs_2(app, env, docnames):
- docnames.remove('images')
+@pytest.mark.sphinx('dummy', testroot='warnings', freshenv=True)
+def test_incremental_reading_for_missing_files(app):
+ # first reading
+ updated = app.builder.read()
+ assert set(updated) == app.env.found_docs == set(app.env.all_docs)
- app.connect('env-before-read-docs', on_env_read_docs_2)
+ # second reading
+ updated = app.builder.read()
- read_docnames = app.builder.read()
- assert len(read_docnames) == 2
+ # "index" is listed up to updated because it contains references
+ # to nonexisting downloadable or image files
+ assert set(updated) == set(['index'])
diff --git a/tests/test_environment.py b/tests/test_environment.py
index 0226e43b8..df0aa20b0 100644
--- a/tests/test_environment.py
+++ b/tests/test_environment.py
@@ -17,8 +17,6 @@ from sphinx.testing.comparer import PathComparer
@pytest.mark.sphinx('dummy')
def test_images(app):
app.build()
- assert ('image file not readable: foo.png'
- in app._warning.getvalue())
tree = app.env.get_doctree('images')
htmlbuilder = StandaloneHTMLBuilder(app)
diff --git a/tests/test_ext_apidoc.py b/tests/test_ext_apidoc.py
index 5bcbb3cc4..3f5f367c4 100644
--- a/tests/test_ext_apidoc.py
+++ b/tests/test_ext_apidoc.py
@@ -49,7 +49,6 @@ def apidoc_params(request):
def test_simple(make_app, apidoc):
outdir = apidoc.outdir
assert (outdir / 'conf.py').isfile()
- assert (outdir / 'autodoc_fodder.rst').isfile()
assert (outdir / 'index.rst').isfile()
app = make_app('text', srcdir=outdir)
@@ -273,7 +272,6 @@ def test_excludes_module_should_not_be_skipped(apidoc):
def test_multibyte_parameters(make_app, apidoc):
outdir = apidoc.outdir
assert (outdir / 'conf.py').isfile()
- assert (outdir / 'autodoc_fodder.rst').isfile()
assert (outdir / 'index.rst').isfile()
conf_py = (outdir / 'conf.py').text()