Skip to content

Commit

Permalink
fix parallel read error and add test
Browse files Browse the repository at this point in the history
  • Loading branch information
rscohn2 committed Sep 30, 2020
1 parent 0a842c0 commit 47887ec
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 0 deletions.
5 changes: 5 additions & 0 deletions notfound/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ def process_doc(self, app, doctree):
if sphinx.version_info >= (3, 0, 0):
metadata.update({'nosearch': True})

def merge_other(self, app, env, docnames, other):
"""Merge in specified data regarding docnames from a different `BuildEnvironment`
object which coming from a subprocess in parallel builds."""
env.metadata.update(other.metadata)


def handle_deprecated_configs(app, *args, **kwargs):
"""
Expand Down
11 changes: 11 additions & 0 deletions tests/examples/parallel-build/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"""
Sample ``conf.py``.
"""

master_doc = 'index'

extensions = [
'notfound.extension',
]


4 changes: 4 additions & 0 deletions tests/examples/parallel-build/five.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
=======
Five
=======

4 changes: 4 additions & 0 deletions tests/examples/parallel-build/four.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
=======
Four
=======

17 changes: 17 additions & 0 deletions tests/examples/parallel-build/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Samples for substitution directives
===================================

..
This is a test of parallel document builds. You need at least 5
documents. See:
https://github.com/adamtheturtle/sphinx-substitution-extensions/pull/173

.. toctree::
:hidden:

one
two
three
four
five
4 changes: 4 additions & 0 deletions tests/examples/parallel-build/one.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
=====
One
=====

4 changes: 4 additions & 0 deletions tests/examples/parallel-build/three.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
=======
Three
=======

4 changes: 4 additions & 0 deletions tests/examples/parallel-build/two.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
=====
Two
=====

5 changes: 5 additions & 0 deletions tests/test_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import pytest
import sphinx
import shutil
import subprocess
import warnings

srcdir = os.path.join(
Expand All @@ -27,6 +28,10 @@ def remove_sphinx_build_output():
shutil.rmtree(build_path)


@pytest.mark.sphinx(srcdir=srcdir)
def test_parallel_build():
subprocess.check_call('sphinx-build -j 2 -W -b html tests/examples/parallel-build build', shell=True)

@pytest.mark.sphinx(srcdir=srcdir)
def test_404_page_created(app, status, warning):
app.build()
Expand Down

0 comments on commit 47887ec

Please sign in to comment.