Skip to content

Commit 4c8b590

Browse files
committed
test
1 parent 495dffe commit 4c8b590

File tree

4 files changed

+76
-0
lines changed

4 files changed

+76
-0
lines changed

tests/test_build_epub.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import os
44
import subprocess
5+
from pathlib import Path
56
from subprocess import CalledProcessError
67
from xml.etree import ElementTree
78

@@ -390,3 +391,21 @@ def test_xml_name_pattern_check():
390391
assert _XML_NAME_PATTERN.match('id-pub')
391392
assert _XML_NAME_PATTERN.match('webpage')
392393
assert not _XML_NAME_PATTERN.match('1bfda21')
394+
395+
396+
@pytest.mark.sphinx('epub', testroot='images')
397+
def test_copy_images(app, status, warning):
398+
app.build()
399+
400+
images_dir = Path(app.outdir) / '_images'
401+
images = {image.name for image in images_dir.rglob('*')}
402+
assert images == {
403+
'img.gif',
404+
'img.pdf',
405+
'img.png',
406+
'rimg.png',
407+
'rimg1.png',
408+
'svgimg.pdf',
409+
'svgimg.svg',
410+
'testimäge.png',
411+
}

tests/test_build_html.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import os
44
import re
55
from itertools import chain, cycle
6+
from pathlib import Path
67
from unittest.mock import ANY, call, patch
78

89
import pytest
@@ -1770,3 +1771,21 @@ def test_theme_having_multiple_stylesheets(app):
17701771

17711772
assert '<link rel="stylesheet" type="text/css" href="_static/mytheme.css" />' in content
17721773
assert '<link rel="stylesheet" type="text/css" href="_static/extra.css" />' in content
1774+
1775+
1776+
@pytest.mark.sphinx('html', testroot='images')
1777+
def test_copy_images(app, status, warning):
1778+
app.build()
1779+
1780+
images_dir = Path(app.outdir) / '_images'
1781+
images = {image.name for image in images_dir.rglob('*')}
1782+
assert images == {
1783+
'img.gif',
1784+
'img.pdf',
1785+
'img.png',
1786+
'rimg.png',
1787+
'rimg1.png',
1788+
'svgimg.pdf',
1789+
'svgimg.svg',
1790+
'testimäge.png',
1791+
}

tests/test_build_latex.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import re
55
import subprocess
66
from itertools import product
7+
from pathlib import Path
78
from shutil import copyfile
89
from subprocess import CalledProcessError
910

@@ -1670,3 +1671,21 @@ def test_latex_code_role(app):
16701671
common_content + '%\n}} code block') in content
16711672
assert (r'\begin{sphinxVerbatim}[commandchars=\\\{\}]' +
16721673
'\n' + common_content + '\n' + r'\end{sphinxVerbatim}') in content
1674+
1675+
1676+
@pytest.mark.sphinx('latex', testroot='images')
1677+
def test_copy_images(app, status, warning):
1678+
app.build()
1679+
1680+
images_dir = Path(app.outdir) / '_images'
1681+
images = {image.name for image in images_dir.rglob('*')}
1682+
assert images == {
1683+
'img.gif',
1684+
'img.pdf',
1685+
'img.png',
1686+
'rimg.png',
1687+
'rimg1.png',
1688+
'svgimg.pdf',
1689+
'svgimg.svg',
1690+
'testimäge.png',
1691+
}

tests/test_build_texinfo.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import os
44
import re
55
import subprocess
6+
from pathlib import Path
67
from subprocess import CalledProcessError
78
from unittest.mock import Mock
89

@@ -137,3 +138,21 @@ def test_texinfo_samp_with_variable(app, status, warning):
137138
assert '@code{@var{variable_only}}' in output
138139
assert '@code{@var{variable} and text}' in output
139140
assert '@code{Show @var{variable} in the middle}' in output
141+
142+
143+
@pytest.mark.sphinx('texinfo', testroot='images')
144+
def test_copy_images(app, status, warning):
145+
app.build()
146+
147+
images_dir = Path(app.outdir) / '_images'
148+
images = {image.name for image in images_dir.rglob('*')}
149+
assert images == {
150+
'img.gif',
151+
'img.pdf',
152+
'img.png',
153+
'rimg.png',
154+
'rimg1.png',
155+
'svgimg.pdf',
156+
'svgimg.svg',
157+
'testimäge.png',
158+
}

0 commit comments

Comments
 (0)