diff options
| author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2019-02-20 12:32:17 +0900 |
|---|---|---|
| committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2019-02-20 12:32:17 +0900 |
| commit | ac4ec473784deed3f6be8eece1f1f0eccd8490ec (patch) | |
| tree | 9566254d53b0afd21423d279879a8ca34840f0d2 /tests/test_application.py | |
| parent | 12c614911ac1ea94e88ec781fd36281ffd026f0a (diff) | |
| download | sphinx-git-ac4ec473784deed3f6be8eece1f1f0eccd8490ec.tar.gz | |
Add testcase for specific build
Diffstat (limited to 'tests/test_application.py')
| -rw-r--r-- | tests/test_application.py | 22 |
1 files changed, 22 insertions, 0 deletions
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') |
