Duplicate doctest results
Ignas opened this issue · comments
>>> CONTEXT.facts.get('name')
Traceback (most recent call last):
...
FactExtractionError: Extractor for fact 'name' was not found.
in a doc.rst passed to restview generates:
<div class="document">
<blockquote>
<pre class="doctest-block">
<span class="gp">>>> </span><span class="n">CONTEXT</span><span class="o">.</span><span class="n">facts</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">'name'</span><span class="p">)</span>
<span class="gt">Traceback (most recent call last):</span>
<span class="c">...</span>
<span class="gr">FactExtractionError</span>: <span class="n">Extractor for fact 'name' was not found.</span>
<span class="gt">Traceback (most recent call last):</span>
<span class="c">...</span>
<span class="gr">FactExtractionError</span>: <span class="n">Extractor for fact 'name' was not found.</span>
</pre>
</blockquote>
</div>
$ pip freeze
Jinja2==2.7.3
MarkupSafe==0.23
PyYAML==3.10
Pygments==2.0.1
Sphinx==1.2.3
click==3.3
cov-core==1.15.0
coverage==3.7.1
docutils==0.12
execnet==1.2.0
flake8==2.0
mccabe==0.2.1
mock==1.0.1
pep8==1.5.7
py==1.4.26
pyflakes==0.8.1
pytest==2.6.4
pytest-cov==1.8.1
pytest-xdist==1.11
sh==1.09
six==1.8.0
sphinx-rtd-theme==0.1.6
sphinx-superfine-theme==0.1.5
sphinxcontrib-httpdomain==1.3.0
tox==1.8.1
virtualenv==1.11.6
wsgiref==0.1.2
zest.releaser==3.53.2
I cannot reproduce.
Your pip freeze
output doesn't list restview itself. What version were you using?
Ok, pip install -U pygments
and I can reproduce!
This is broken with Pygments 2.0.1. It works fine with Pygments 1.6.
Looks like a Pygments bug to me:
>>> import pygments.lexers, pygments.formatters
>>> lexer = pygments.lexers.PythonConsoleLexer()
>>> formatter = pygments.formatters.HtmlFormatter(nowrap=True)
>>> print(pygments.highlight('>>> f()\nTraceback (most recent call last):\n...\nException: foo', lexer, formatter))
<span class="gp">>>> </span><span class="n">f</span><span class="p">()</span>
<span class="gt">Traceback (most recent call last):</span>
<span class="c">...</span>
<span class="gr">Exception</span>: <span class="n">foo</span>
<span class="gt">Traceback (most recent call last):</span>
<span class="c">...</span>
<span class="gr">Exception</span>: <span class="n">foo</span>
Filed as https://bitbucket.org/birkenfeld/pygments-main/issue/1068/duplicates-exception-in-doctest-block
Closing this issue since it's not a bug in restview.
Thanks, indeed, I can see this in the resulting docs too. Thanks for filing it with pygments.