diff options
Diffstat (limited to '')
-rw-r--r-- | tests/test_directives/test_directive_code.py (renamed from tests/test_directive_code.py) | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/tests/test_directive_code.py b/tests/test_directives/test_directive_code.py index df7de57..2783d8f 100644 --- a/tests/test_directive_code.py +++ b/tests/test_directives/test_directive_code.py @@ -295,7 +295,7 @@ def test_LiteralIncludeReader_diff(testroot, literal_inc_path): @pytest.mark.sphinx('xml', testroot='directive-code') def test_code_block(app, status, warning): - app.builder.build('index') + app.build(filenames=[app.srcdir / 'index.rst']) et = etree_parse(app.outdir / 'index.xml') secs = et.findall('./section/section') code_block = secs[0].findall('literal_block') @@ -311,13 +311,13 @@ def test_code_block(app, status, warning): @pytest.mark.sphinx('html', testroot='directive-code') def test_force_option(app, status, warning): - app.builder.build(['force']) + app.build(filenames=[app.srcdir / 'force.rst']) assert 'force.rst' not in warning.getvalue() @pytest.mark.sphinx('html', testroot='directive-code') def test_code_block_caption_html(app, status, warning): - app.builder.build(['caption']) + app.build(filenames=[app.srcdir / 'caption.rst']) html = (app.outdir / 'caption.html').read_text(encoding='utf8') caption = ('<div class="code-block-caption">' '<span class="caption-number">Listing 1 </span>' @@ -329,7 +329,7 @@ def test_code_block_caption_html(app, status, warning): @pytest.mark.sphinx('latex', testroot='directive-code') def test_code_block_caption_latex(app, status, warning): - app.builder.build_all() + app.build(force_all=True) latex = (app.outdir / 'python.tex').read_text(encoding='utf8') caption = '\\sphinxSetupCaptionForVerbatim{caption \\sphinxstyleemphasis{test} rb}' label = '\\def\\sphinxLiteralBlockLabel{\\label{\\detokenize{caption:id1}}}' @@ -342,7 +342,7 @@ def test_code_block_caption_latex(app, status, warning): @pytest.mark.sphinx('latex', testroot='directive-code') def test_code_block_namedlink_latex(app, status, warning): - app.builder.build_all() + app.build(force_all=True) latex = (app.outdir / 'python.tex').read_text(encoding='utf8') label1 = '\\def\\sphinxLiteralBlockLabel{\\label{\\detokenize{caption:name-test-rb}}}' link1 = '\\hyperref[\\detokenize{caption:name-test-rb}]'\ @@ -359,7 +359,7 @@ def test_code_block_namedlink_latex(app, status, warning): @pytest.mark.sphinx('latex', testroot='directive-code') def test_code_block_emphasize_latex(app, status, warning): - app.builder.build(['emphasize']) + app.build(filenames=[app.srcdir / 'emphasize.rst']) latex = (app.outdir / 'python.tex').read_text(encoding='utf8').replace('\r\n', '\n') includes = '\\fvset{hllines={, 5, 6, 13, 14, 15, 24, 25, 26,}}%\n' assert includes in latex @@ -369,7 +369,7 @@ def test_code_block_emphasize_latex(app, status, warning): @pytest.mark.sphinx('xml', testroot='directive-code') def test_literal_include(app, status, warning): - app.builder.build(['index']) + app.build(filenames=[app.srcdir / 'index.rst']) et = etree_parse(app.outdir / 'index.xml') secs = et.findall('./section/section') literal_include = secs[1].findall('literal_block') @@ -381,7 +381,7 @@ def test_literal_include(app, status, warning): @pytest.mark.sphinx('xml', testroot='directive-code') def test_literal_include_block_start_with_comment_or_brank(app, status, warning): - app.builder.build(['python']) + app.build(filenames=[app.srcdir / 'python.rst']) et = etree_parse(app.outdir / 'python.xml') secs = et.findall('./section/section') literal_include = secs[0].findall('literal_block') @@ -405,7 +405,7 @@ def test_literal_include_block_start_with_comment_or_brank(app, status, warning) @pytest.mark.sphinx('html', testroot='directive-code') def test_literal_include_linenos(app, status, warning): - app.builder.build(['linenos']) + app.build(filenames=[app.srcdir / 'linenos.rst']) html = (app.outdir / 'linenos.html').read_text(encoding='utf8') # :linenos: @@ -423,7 +423,7 @@ def test_literal_include_linenos(app, status, warning): @pytest.mark.sphinx('latex', testroot='directive-code') def test_literalinclude_file_whole_of_emptyline(app, status, warning): - app.builder.build_all() + app.build(force_all=True) latex = (app.outdir / 'python.tex').read_text(encoding='utf8').replace('\r\n', '\n') includes = ( '\\begin{sphinxVerbatim}' @@ -437,7 +437,7 @@ def test_literalinclude_file_whole_of_emptyline(app, status, warning): @pytest.mark.sphinx('html', testroot='directive-code') def test_literalinclude_caption_html(app, status, warning): - app.builder.build_all() + app.build(force_all=True) html = (app.outdir / 'caption.html').read_text(encoding='utf8') caption = ('<div class="code-block-caption">' '<span class="caption-number">Listing 2 </span>' @@ -449,7 +449,7 @@ def test_literalinclude_caption_html(app, status, warning): @pytest.mark.sphinx('latex', testroot='directive-code') def test_literalinclude_caption_latex(app, status, warning): - app.builder.build('index') + app.build(filenames='index') latex = (app.outdir / 'python.tex').read_text(encoding='utf8') caption = '\\sphinxSetupCaptionForVerbatim{caption \\sphinxstylestrong{test} py}' label = '\\def\\sphinxLiteralBlockLabel{\\label{\\detokenize{caption:id2}}}' @@ -462,7 +462,7 @@ def test_literalinclude_caption_latex(app, status, warning): @pytest.mark.sphinx('latex', testroot='directive-code') def test_literalinclude_namedlink_latex(app, status, warning): - app.builder.build('index') + app.build(filenames='index') latex = (app.outdir / 'python.tex').read_text(encoding='utf8') label1 = '\\def\\sphinxLiteralBlockLabel{\\label{\\detokenize{caption:name-test-py}}}' link1 = '\\hyperref[\\detokenize{caption:name-test-py}]'\ @@ -479,7 +479,7 @@ def test_literalinclude_namedlink_latex(app, status, warning): @pytest.mark.sphinx('xml', testroot='directive-code') def test_literalinclude_classes(app, status, warning): - app.builder.build(['classes']) + app.build(filenames=[app.srcdir / 'classes.rst']) et = etree_parse(app.outdir / 'classes.xml') secs = et.findall('./section/section') @@ -496,7 +496,7 @@ def test_literalinclude_classes(app, status, warning): @pytest.mark.sphinx('xml', testroot='directive-code') def test_literalinclude_pydecorators(app, status, warning): - app.builder.build(['py-decorators']) + app.build(filenames=[app.srcdir / 'py-decorators.rst']) et = etree_parse(app.outdir / 'py-decorators.xml') secs = et.findall('./section/section') @@ -537,7 +537,7 @@ def test_literalinclude_pydecorators(app, status, warning): @pytest.mark.sphinx('dummy', testroot='directive-code') def test_code_block_highlighted(app, status, warning): - app.builder.build(['highlight']) + app.build(filenames=[app.srcdir / 'highlight.rst']) doctree = app.env.get_doctree('highlight') codeblocks = list(doctree.findall(nodes.literal_block)) @@ -549,7 +549,7 @@ def test_code_block_highlighted(app, status, warning): @pytest.mark.sphinx('html', testroot='directive-code') def test_linenothreshold(app, status, warning): - app.builder.build(['linenothreshold']) + app.build(filenames=[app.srcdir / 'linenothreshold.rst']) html = (app.outdir / 'linenothreshold.html').read_text(encoding='utf8') # code-block using linenothreshold @@ -570,7 +570,7 @@ def test_linenothreshold(app, status, warning): @pytest.mark.sphinx('dummy', testroot='directive-code') def test_code_block_dedent(app, status, warning): - app.builder.build(['dedent']) + app.build(filenames=[app.srcdir / 'dedent.rst']) doctree = app.env.get_doctree('dedent') codeblocks = list(doctree.findall(nodes.literal_block)) # Note: comparison string should not have newlines at the beginning or end |