Skip to content

Commit

Permalink
Merge d3835c1 into 9d27dee
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsewell committed Mar 2, 2020
2 parents 9d27dee + d3835c1 commit 918d2ae
Show file tree
Hide file tree
Showing 13 changed files with 113 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/bibtex_test/example_md.md
@@ -0,0 +1,10 @@
# Test MyST

{cite}`unknown`



```{bibliography} references2.bib
:labelprefix: md2
:keyprefix: md2-
```
10 changes: 10 additions & 0 deletions docs/bibtex_test/example_rst.rst
@@ -0,0 +1,10 @@
Test rST
--------

:cite:`unknown`



.. bibliography:: references3.bib
:labelprefix: rst2
:keyprefix: rst2-
6 changes: 6 additions & 0 deletions docs/bibtex_test/index.md
@@ -0,0 +1,6 @@
# Test bibtex with missing ref

```{toctree}
example_rst.rst
example_md.md
```
12 changes: 12 additions & 0 deletions docs/bibtex_test/references2.bib
@@ -0,0 +1,12 @@
###
Single example from the QuantEcon Bib
###
@article{abc,
title={a Skewed wealth distributions: Theory and empirics},
author={Benhabib, Jess and Bisin, Alberto},
journal={Journal of Economic Literature},
volume={56},
number={4},
pages={1261--91},
year={2018}
}
12 changes: 12 additions & 0 deletions docs/bibtex_test/references3.bib
@@ -0,0 +1,12 @@
###
Single example from the QuantEcon Bib
###
@article{xyz,
title={b Skewed wealth distributions: Theory and empirics},
author={Benhabib, Jess and Bisin, Alberto},
journal={Journal of Economic Literature},
volume={56},
number={4},
pages={1261--91},
year={2018}
}
1 change: 1 addition & 0 deletions docs/index.md
Expand Up @@ -54,5 +54,6 @@ caption: Contents
using/index.md
examples/index.md
develop/index.md
bibtex_test/index.md
package_api.md
```
1 change: 1 addition & 0 deletions setup.py
Expand Up @@ -50,6 +50,7 @@
"pytest-cov",
"pytest-regressions",
"beautifulsoup4",
"sphinxcontrib-bibtex~=1.0",
],
"rtd": [
"sphinxcontrib-bibtex",
Expand Down
2 changes: 2 additions & 0 deletions tests/test_sphinx/sourcedirs/bibtex_norefs/conf.py
@@ -0,0 +1,2 @@
extensions = ["myst_parser", "sphinxcontrib.bibtex"]
exclude_patterns = ["_build"]
4 changes: 4 additions & 0 deletions tests/test_sphinx/sourcedirs/bibtex_norefs/index.md
@@ -0,0 +1,4 @@
missing ref {cite}`abc`

```{bibliography} references.bib
```
12 changes: 12 additions & 0 deletions tests/test_sphinx/sourcedirs/bibtex_norefs/references.bib
@@ -0,0 +1,12 @@
###
Single example from the QuantEcon Bib
###
@article{benhabib2018skewed,
title={Skewed wealth distributions: Theory and empirics},
author={Benhabib, Jess and Bisin, Alberto},
journal={Journal of Economic Literature},
volume={56},
number={4},
pages={1261--91},
year={2018}
}
22 changes: 22 additions & 0 deletions tests/test_sphinx/test_sphinx_builds.py
Expand Up @@ -44,3 +44,25 @@ def test_includes(

get_sphinx_app_doctree(app, filename="index.doctree", regress=True)
get_sphinx_app_output(app, filename="index.html", regress_html=True)


@pytest.mark.sphinx(
buildername="html", srcdir=os.path.join(SOURCE_DIR, "bibtex_norefs"), freshenv=True
)
def test_bibtex_norefs(
app,
status,
warning,
get_sphinx_app_doctree,
get_sphinx_app_output,
remove_sphinx_builds,
):
"""Test of spinxcontrib-bibtex extension."""
app.build()

assert "build succeeded" in status.getvalue() # Build succeeded
warnings = warning.getvalue().strip()
assert "citation not found: abc" in warnings

get_sphinx_app_doctree(app, filename="index.doctree", regress=True)
get_sphinx_app_output(app, filename="index.html", regress_html=True)
14 changes: 14 additions & 0 deletions tests/test_sphinx/test_sphinx_builds/test_bibtex_norefs.html
@@ -0,0 +1,14 @@
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<p>
missing ref
<span class="bibtex" id="id1">
[abc]
</span>
</p>
<p id="bibtex-bibliography-index-0">
</p>
</div>
</div>
</div>
7 changes: 7 additions & 0 deletions tests/test_sphinx/test_sphinx_builds/test_bibtex_norefs.xml
@@ -0,0 +1,7 @@
<document source="index.md">
<paragraph>
missing ref
<pending_xref classes="bibtex" ids="id1" refdomain="citation" reftarget="abc" reftype="ref" refwarn="True" support_smartquotes="False">
<inline>
[abc]
<paragraph ids="bibtex-bibliography-index-0">

0 comments on commit 918d2ae

Please sign in to comment.