diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2019-02-03 22:10:43 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2019-02-14 02:20:55 +0900 |
commit | 891178e8ed6cde1b7bf3048ca73b784caf96e010 (patch) | |
tree | 52784bb45ac30de56b1cd758757f14f18cbf8ab6 /tests/test_builder.py | |
parent | 973fbb81e48f1574741c9babebd5d8b7a036e8cb (diff) | |
download | sphinx-git-891178e8ed6cde1b7bf3048ca73b784caf96e010.tar.gz |
test: Reduce warnings on building test-root
Note: all warnings are tested on test-warnings.
Diffstat (limited to 'tests/test_builder.py')
-rw-r--r-- | tests/test_builder.py | 34 |
1 files changed, 13 insertions, 21 deletions
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']) |