This commit is contained in:
Takeshi KOMIYA 2018-09-24 09:15:07 +09:00
parent 84e1eeb8a2
commit 7e23a061b3
3 changed files with 12 additions and 12 deletions

View File

@ -390,7 +390,7 @@ class BuildEnvironment:
exclude_paths = (self.config.exclude_patterns +
self.config.templates_path +
builder.get_asset_paths())
self.project.discovery(exclude_paths)
self.project.discover(exclude_paths)
# Current implementation is applying translated messages in the reading
# phase.Therefore, in order to apply the updated message catalog, it is

View File

@ -44,7 +44,7 @@ class Project(object):
"""Take over a result of last build."""
self.docnames = other.docnames
def discovery(self, exclude_paths=[]):
def discover(self, exclude_paths=[]):
# type: (List[unicode]) -> Set[unicode]
"""Find all document files in the source directory and put them in
:attr:`docnames`.

View File

@ -16,7 +16,7 @@ import pytest
from sphinx.project import Project
def test_project_discovery(rootdir):
def test_project_discover(rootdir):
project = Project(rootdir / 'test-root', {})
docnames = {'autodoc', 'bom', 'extapi', 'extensions', 'footnote', 'images',
@ -26,29 +26,29 @@ def test_project_discovery(rootdir):
# basic case
project.source_suffix = ['.txt']
assert project.discovery() == docnames
assert project.discover() == docnames
# exclude_paths option
assert project.discovery(['subdir/*']) == docnames - subdir_docnames
assert project.discover(['subdir/*']) == docnames - subdir_docnames
# exclude_patterns
assert project.discovery(['.txt', 'subdir/*']) == docnames - subdir_docnames
assert project.discover(['.txt', 'subdir/*']) == docnames - subdir_docnames
# multiple source_suffixes
project.source_suffix = ['.txt', '.foo']
assert project.discovery() == docnames | {'otherext'}
assert project.discover() == docnames | {'otherext'}
# complicated source_suffix
project.source_suffix = ['.foo.png']
assert project.discovery() == {'img'}
assert project.discover() == {'img'}
# templates_path
project.source_suffix = ['.html']
assert project.discovery() == {'_templates/layout',
'_templates/customsb',
'_templates/contentssb'}
assert project.discover() == {'_templates/layout',
'_templates/customsb',
'_templates/contentssb'}
assert project.discovery(['_templates']) == set()
assert project.discover(['_templates']) == set()
@pytest.mark.sphinx(testroot='basic')