diff --git a/tests/test_application.py b/tests/test_application.py index 87ee72f63..1a4d41289 100644 --- a/tests/test_application.py +++ b/tests/test_application.py @@ -7,6 +7,9 @@ :copyright: Copyright 2007-2019 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ + +from unittest.mock import Mock + import pytest from docutils import nodes @@ -113,3 +116,22 @@ def test_add_is_parallel_allowed(app, status, warning): "for parallel reading, assuming it isn't - please ") in warning.getvalue() app.extensions.pop('write_serial') warning.truncate(0) # reset warnings + + +@pytest.mark.sphinx('dummy', testroot='root') +def test_build_specific(app): + app.builder.build = Mock() + filenames = [app.srcdir / 'index.txt', # normal + app.srcdir / 'images', # without suffix + app.srcdir / 'notfound.txt', # not found + app.srcdir / 'img.png', # unknown suffix + '/index.txt', # external file + app.srcdir / 'subdir', # directory + app.srcdir / 'subdir/includes.txt', # file on subdir + app.srcdir / 'subdir/../subdir/excluded.txt'] # not normalized + app.build(False, filenames) + + expected = ['index', 'images', 'img.png', 'subdir/includes', 'subdir/excluded'] + app.builder.build.assert_called_with(expected, + method='specific', + summary='5 source files given on command line')