diff --git a/sphinx/environment/__init__.py b/sphinx/environment/__init__.py index 7be84ab29..52cf7fa95 100644 --- a/sphinx/environment/__init__.py +++ b/sphinx/environment/__init__.py @@ -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 diff --git a/sphinx/project.py b/sphinx/project.py index ed910088e..82ea54ef3 100644 --- a/sphinx/project.py +++ b/sphinx/project.py @@ -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`. diff --git a/tests/test_project.py b/tests/test_project.py index 3b48c2de3..3ae00ef4e 100644 --- a/tests/test_project.py +++ b/tests/test_project.py @@ -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')