diff options
Diffstat (limited to 'tests/test_ext_doctest.py')
| -rw-r--r-- | tests/test_ext_doctest.py | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/tests/test_ext_doctest.py b/tests/test_ext_doctest.py index 5b0a6590f..6726b1725 100644 --- a/tests/test_ext_doctest.py +++ b/tests/test_ext_doctest.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ test_doctest ~~~~~~~~~~~~ @@ -11,10 +10,10 @@ import os from collections import Counter +from docutils import nodes import pytest from packaging.specifiers import InvalidSpecifier from packaging.version import InvalidVersion -from six import PY2 from sphinx.ext.doctest import is_allowed_version @@ -33,6 +32,23 @@ def test_build(app, status, warning): assert cleanup_called == 3, 'testcleanup did not get executed enough times' +@pytest.mark.sphinx('dummy', testroot='ext-doctest') +def test_highlight_language_default(app, status, warning): + app.build() + doctree = app.env.get_doctree('doctest') + for node in doctree.traverse(nodes.literal_block): + assert node['language'] in ('python3', 'pycon3', 'none') + + +@pytest.mark.sphinx('dummy', testroot='ext-doctest', + confoverrides={'highlight_language': 'python'}) +def test_highlight_language_python2(app, status, warning): + app.build() + doctree = app.env.get_doctree('doctest') + for node in doctree.traverse(nodes.literal_block): + assert node['language'] in ('python', 'pycon', 'none') + + def test_is_allowed_version(): assert is_allowed_version('<3.4', '3.3') is True assert is_allowed_version('<3.4', '3.3') is True @@ -112,9 +128,6 @@ def record(directive, part, should_skip): return 'Recorded {} {} {}'.format(directive, part, should_skip) -@pytest.mark.xfail( - PY2, reason='node.source points to document instead of filename', -) @pytest.mark.sphinx('doctest', testroot='ext-doctest-with-autodoc') def test_reporting_with_autodoc(app, status, warning, capfd): # Patch builder to get a copy of the output |
