Skip to content

Commit

Permalink
Merge pull request #81 from mcmtroffaes/feature/fix-tests
Browse files Browse the repository at this point in the history
Fix some issues for the latest version of Sphinx.
  • Loading branch information
mcmtroffaes committed Mar 20, 2015
2 parents 470ac39 + 5cba171 commit ee43fc2
Show file tree
Hide file tree
Showing 20 changed files with 198 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
* Document how to create custom label styles (see issue #77, reported
by tino).

* Disable parallel_read_safe for Sphinx 1.3 and later (see issue #80,
reported by andreacassioli).

0.3.1 (10 July 2014)
--------------------

Expand Down
1 change: 1 addition & 0 deletions release_checklist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
- git push origin master
- git push --tags
- git checkout develop
- git branch -d release/x.x.x
* activate new version on readthedocs.org
* prep for next cycle
- git checkout develop
Expand Down
4 changes: 4 additions & 0 deletions sphinxcontrib/bibtex/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,7 @@ def setup(app):
app.connect("doctree-resolved", process_citation_references)
app.connect("env-purge-doc", purge_bibtex_cache)
app.connect("env-updated", check_duplicate_labels)
# Parallel read is not safe at the moment: in the current design,
# the document that contains references must be read last for all
# references to be resolved.
return {'parallel_read_safe': False}
2 changes: 1 addition & 1 deletion test/issue1/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@
html_title = project
html_use_index = False
html_show_sourcelink = False
html_add_permalinks = None
html_add_permalinks = ""
2 changes: 2 additions & 0 deletions test/issue80/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
extensions = ['sphinxcontrib.bibtex']
exclude_patterns = ['_build']
15 changes: 15 additions & 0 deletions test/issue80/contents.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Contents
========

.. toctree::

doc0
doc1
doc2
doc3
doc4
doc5
doc6
doc7
doc8
doc9
2 changes: 2 additions & 0 deletions test/issue80/doc0.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
doc0
----
4 changes: 4 additions & 0 deletions test/issue80/doc1.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
doc1
----

:cite:`1979-shafer`
4 changes: 4 additions & 0 deletions test/issue80/doc2.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
doc2
----

:cite:`1977-morris`
4 changes: 4 additions & 0 deletions test/issue80/doc3.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
doc3
----

:cite:`1972-savage`
4 changes: 4 additions & 0 deletions test/issue80/doc4.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
doc4
----

:cite:`rockafellar-1970`
4 changes: 4 additions & 0 deletions test/issue80/doc5.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
doc5
----

:cite:`1966-arrow`
4 changes: 4 additions & 0 deletions test/issue80/doc6.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
doc6
----

:cite:`1934-hildebrandt`
4 changes: 4 additions & 0 deletions test/issue80/doc7.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
doc7
----

:cite:`1986-genest-zidek-combining-probability-distributions`
4 changes: 4 additions & 0 deletions test/issue80/doc8.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
doc8
----

:cite:`2001-kennedy-calibration`
4 changes: 4 additions & 0 deletions test/issue80/doc9.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
doc9
----

.. bibliography:: refs.bib
85 changes: 85 additions & 0 deletions test/issue80/refs.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
@article{1979-shafer,
author = {Glenn Shafer},
title = {Allocations of Probability},
journal = {The Annals of Probability},
year = {1979},
volume = {7},
number = {5},
pages = {827--839}
}

@article{1977-morris,
author = {Peter A. Morris},
title = {Combining expert judgments: a {B}ayesian approach},
journal = {Management Science},
year = {1977},
volume = {23},
number = {7},
pages = {679--693}
}

@book{1972-savage,
author = {Leonard J. Savage},
title = {The Foundations of Statistics},
publisher = {Dover},
year = {1972},
address = {New York}
}

@book{rockafellar-1970,
author = {R. Tyrrell Rockafellar},
title = {Convex Analysis},
publisher = {Princeton University Press},
year = {1970},
address = {Princeton}
}

@article{1966-arrow,
author = {Arrow, K.},
title = {Exposition of the theory of choice under uncertainty},
journal = {Synthese},
year = {1966},
volume = {16},
number = {3--4},
pages = {253--269}
}

@article{1951-ville,
author = {Jean Ville and P. K. Newman},
title = {The Existence-Conditions of a Total Utility Function },
journal = {The Review of Economic Studies},
year = {1951},
volume = {19},
number = {2},
pages = {123--128}
}

@article{1934-hildebrandt,
author = {T. H. Hildebrandt},
title = {On Bounded Functional Operations},
journal = {Transactions of the American Mathematical Society},
year = {1934},
volume = {36},
number = {4},
pages = {868--875}
}

@article{1986-genest-zidek-combining-probability-distributions,
author = {Christian Genest and James V. Zidek},
title = {Combining Probability Distributions: A Critique and an Annotated Bibliography},
journal = {Statistical Science},
year = {1986},
volume = {1},
number = {1},
pages = {114--148}
}

@article{2001-kennedy-calibration,
author = {Marc C. Kennedy and Anthony O'Hagan},
title = {Bayesian Calibration of Computer Models},
journal = {Journal of the Royal Statistical Society, Series B},
year = {2001},
volume = {63},
number = {3},
pages = {425--464}
}
27 changes: 27 additions & 0 deletions test/test_issue80_parallel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""
test_issue80
~~~~~~~~~~~~
Test parallel build.
"""

import re
from six import StringIO

from util import path, with_app

srcdir = path(__file__).parent.joinpath('issue80').abspath()
warnfile = StringIO()


def teardown_module():
(srcdir / '_build').rmtree(True)


@with_app(srcdir=srcdir, warning=warnfile, parallel=8)
def test_issue80_parallel(app):
app.builder.build_all()
warnings = warnfile.getvalue()
assert re.search(
'the sphinxcontrib.bibtex extension is not safe for parallel '
'reading, doing serial read', warnings)
19 changes: 19 additions & 0 deletions test/test_issue80_serial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"""
test_issue80
~~~~~~~~~~~~
Test parallel build.
"""

from util import path, with_app

srcdir = path(__file__).parent.joinpath('issue80').abspath()


def teardown_module():
(srcdir / '_build').rmtree(True)


@with_app(srcdir=srcdir, warningiserror=True, parallel=0)
def test_issue80_serial(app):
app.builder.build_all()
5 changes: 3 additions & 2 deletions test/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def __init__(self, srcdir=None, confdir=None, outdir=None, doctreedir=None,
buildername='html', confoverrides=None,
status=None, warning=None, freshenv=None,
warningiserror=None, tags=None,
confname='conf.py', cleanenv=False):
confname='conf.py', cleanenv=False, verbosity=0, parallel=0):

application.CONFIG_FILENAME = confname

Expand Down Expand Up @@ -178,7 +178,8 @@ def __init__(self, srcdir=None, confdir=None, outdir=None, doctreedir=None,
application.Sphinx.__init__(self, srcdir, confdir, outdir, doctreedir,
buildername, confoverrides, status,
warning,
freshenv, warningiserror, tags)
freshenv, warningiserror, tags,
verbosity, parallel)

def cleanup(self, doctrees=False):
AutoDirective._registry.clear()
Expand Down

0 comments on commit ee43fc2

Please sign in to comment.