-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix parallel read error and add test #112
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
""" | ||
Sample ``conf.py``. | ||
""" | ||
|
||
master_doc = 'index' | ||
|
||
extensions = [ | ||
'notfound.extension', | ||
] | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
======= | ||
Five | ||
======= | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
======= | ||
Four | ||
======= | ||
|
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
===== | ||
One | ||
===== | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
======= | ||
Three | ||
======= | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
===== | ||
Two | ||
===== | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
import pytest | ||
import sphinx | ||
import shutil | ||
import subprocess | ||
import warnings | ||
|
||
srcdir = os.path.join( | ||
|
@@ -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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can't we call There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean, similar to what we are doing in the rest of the tests. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The other tests rely on SphinxTestApp, which does not have a way to pass parallel=2 through to the Sphinx constructor. I submitted a PR to add it, but we would have to wait for the next sphinx release, and it would not be usable for your testing that runs on older versions of sphinx. You can see a discussion of the problem in a PR for another extension: executablebooks/sphinx-book-theme#225 (comment) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see. Makes sense. So, should we check stderr or exit code or similar here to be sure that the subprocess didn't failed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, check call_raises an exception. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right. And I added the test first and verified that it caught the problem before adding the fix.
humitos marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
@pytest.mark.sphinx(srcdir=srcdir) | ||
def test_404_page_created(app, status, warning): | ||
app.build() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have an example of other collector that works in parallel and implement this method? It would be good to put it here as reference as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could not find an example, so I read the documentation and printed out values while processing documents. Maybe @jakobandersen would be willing to look at it, because he diagnosed the problem here: sphinx-doc/sphinx#8256
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not familiar with what this extension is doing, so perhaps the following is irrelevant: technically you should not copy all data from
other
, but only the data related to the documents indocnames
. However, I don't think I ever ran into a case where this in practice didn't mean "copy everything fromother
", so maybe is really is a guarantee thatother
at most contains data about those documents.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be easier to add the filter than to prove whether or not it is needed. I will submit another PR.