Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf48c72c

Browse files
committed
Move test data into a single subdirectory
Consolidating these files make it easier to remove or restore themwithout having to track each one individually.
1 parent759765c commitf48c72c

25 files changed

+21
-26
lines changed
File renamed without changes.

‎lib/matplotlib/tests/meson.build

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,6 @@ py3.install_sources(python_sources,
9999

100100
install_data(
101101
'README',
102-
'Courier10PitchBT-Bold.pfb',
103-
'cmr10.pfb',
104-
'mpltest.ttf',
105-
'test_nbagg_01.ipynb',
106-
'test_inline_01.ipynb',
107102
install_tag:'tests',
108103
install_dir: py3.get_install_dir(subdir:'matplotlib/tests/'))
109104

@@ -112,6 +107,6 @@ install_subdir(
112107
install_tag:'tests',
113108
install_dir: py3.get_install_dir(subdir:'matplotlib/tests'))
114109
install_subdir(
115-
'tinypages',
110+
'data',
116111
install_tag:'tests',
117-
install_dir: py3.get_install_dir(subdir:'matplotlib/tests'))
112+
install_dir: py3.get_install_dir(subdir:'matplotlib/tests/'))

‎lib/matplotlib/tests/test_backend_inline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414

1515
deftest_ipynb():
16-
nb_path=Path(__file__).parent/'test_inline_01.ipynb'
16+
nb_path=Path(__file__).parent/'data/test_inline_01.ipynb'
1717

1818
withTemporaryDirectory()astmpdir:
1919
out_path=Path(tmpdir,"out.ipynb")

‎lib/matplotlib/tests/test_backend_nbagg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515

1616
deftest_ipynb():
17-
nb_path=Path(__file__).parent/'test_nbagg_01.ipynb'
17+
nb_path=Path(__file__).parent/'data/test_nbagg_01.ipynb'
1818

1919
withTemporaryDirectory()astmpdir:
2020
out_path=Path(tmpdir,"out.ipynb")

‎lib/matplotlib/tests/test_backend_pdf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,6 @@ def test_truetype_conversion(recwarn):
425425
mpl.rcParams['pdf.fonttype']=3
426426
fig,ax=plt.subplots()
427427
ax.text(0,0,"ABCDE",
428-
font=Path(__file__).with_name("mpltest.ttf"),fontsize=80)
428+
font=Path(__file__).parent/"data/mpltest.ttf",fontsize=80)
429429
ax.set_xticks([])
430430
ax.set_yticks([])

‎lib/matplotlib/tests/test_font_manager.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def test_user_fonts_linux(tmpdir, monkeypatch):
164164
# Prepare a temporary user font directory
165165
user_fonts_dir=tmpdir.join('fonts')
166166
user_fonts_dir.ensure(dir=True)
167-
shutil.copyfile(Path(__file__).parent/font_test_file,
167+
shutil.copyfile(Path(__file__).parent/'data'/font_test_file,
168168
user_fonts_dir.join(font_test_file))
169169

170170
withmonkeypatch.context()asm:
@@ -181,7 +181,7 @@ def test_user_fonts_linux(tmpdir, monkeypatch):
181181
deftest_addfont_as_path():
182182
"""Smoke test that addfont() accepts pathlib.Path."""
183183
font_test_file='mpltest.ttf'
184-
path=Path(__file__).parent/font_test_file
184+
path=Path(__file__).parent/'data'/font_test_file
185185
try:
186186
fontManager.addfont(path)
187187
added,= (fontforfontinfontManager.ttflist
@@ -215,7 +215,7 @@ def test_user_fonts_win32():
215215
os.makedirs(user_fonts_dir)
216216

217217
# Copy the test font to the user font directory
218-
shutil.copy(Path(__file__).parent/font_test_file,user_fonts_dir)
218+
shutil.copy(Path(__file__).parent/'data'/font_test_file,user_fonts_dir)
219219

220220
# Now, the font should be available
221221
fonts=findSystemFonts()

‎lib/matplotlib/tests/test_mathtext.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ def test_mathtext_fallback_invalid():
437437
("stix", ['DejaVu Sans','mpltest','STIXGeneral','STIXGeneral','STIXGeneral'])])
438438
deftest_mathtext_fallback(fallback,fontlist):
439439
mpl.font_manager.fontManager.addfont(
440-
str(Path(__file__).resolve().parent/'mpltest.ttf'))
440+
(Path(__file__).resolve().parent/'data/mpltest.ttf'))
441441
mpl.rcParams["svg.fonttype"]='none'
442442
mpl.rcParams['mathtext.fontset']='custom'
443443
mpl.rcParams['mathtext.rm']='mpltest'

‎lib/matplotlib/tests/test_sphinxext.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ def build_sphinx_html(source_dir, doctree_dir, html_dir, extra_args=None):
3333

3434

3535
deftest_tinypages(tmp_path):
36-
shutil.copytree(Path(__file__).parent/'tinypages',tmp_path,
36+
shutil.copytree(Path(__file__).parent/'data/tinypages',tmp_path,
3737
dirs_exist_ok=True)
3838
html_dir=tmp_path/'_build'/'html'
3939
img_dir=html_dir/'_images'
4040
doctree_dir=tmp_path/'doctrees'
4141
# Build the pages with warnings turned into errors
4242
cmd= [sys.executable,'-msphinx','-W','-b','html',
4343
'-d',str(doctree_dir),
44-
str(Path(__file__).parent/'tinypages'),str(html_dir)]
44+
str(Path(__file__).parent/'data/tinypages'),str(html_dir)]
4545
# On CI, gcov emits warnings (due to agg headers being included with the
4646
# same name in multiple extension modules -- but we don't care about their
4747
# coverage anyways); hide them using GCOV_ERROR_FILE.
@@ -126,8 +126,8 @@ def plot_directive_file(num):
126126

127127
deftest_plot_html_show_source_link(tmp_path):
128128
parent=Path(__file__).parent
129-
shutil.copyfile(parent/'tinypages/conf.py',tmp_path/'conf.py')
130-
shutil.copytree(parent/'tinypages/_static',tmp_path/'_static')
129+
shutil.copyfile(parent/'data/tinypages/conf.py',tmp_path/'conf.py')
130+
shutil.copytree(parent/'data/tinypages/_static',tmp_path/'_static')
131131
doctree_dir=tmp_path/'doctrees'
132132
(tmp_path/'index.rst').write_text("""
133133
.. plot::
@@ -151,8 +151,8 @@ def test_show_source_link_true(tmp_path, plot_html_show_source_link):
151151
# Test that a source link is generated if :show-source-link: is true,
152152
# whether or not plot_html_show_source_link is true.
153153
parent=Path(__file__).parent
154-
shutil.copyfile(parent/'tinypages/conf.py',tmp_path/'conf.py')
155-
shutil.copytree(parent/'tinypages/_static',tmp_path/'_static')
154+
shutil.copyfile(parent/'data/tinypages/conf.py',tmp_path/'conf.py')
155+
shutil.copytree(parent/'data/tinypages/_static',tmp_path/'_static')
156156
doctree_dir=tmp_path/'doctrees'
157157
(tmp_path/'index.rst').write_text("""
158158
.. plot::
@@ -171,8 +171,8 @@ def test_show_source_link_false(tmp_path, plot_html_show_source_link):
171171
# Test that a source link is NOT generated if :show-source-link: is false,
172172
# whether or not plot_html_show_source_link is true.
173173
parent=Path(__file__).parent
174-
shutil.copyfile(parent/'tinypages/conf.py',tmp_path/'conf.py')
175-
shutil.copytree(parent/'tinypages/_static',tmp_path/'_static')
174+
shutil.copyfile(parent/'data/tinypages/conf.py',tmp_path/'conf.py')
175+
shutil.copytree(parent/'data/tinypages/_static',tmp_path/'_static')
176176
doctree_dir=tmp_path/'doctrees'
177177
(tmp_path/'index.rst').write_text("""
178178
.. plot::
@@ -187,7 +187,7 @@ def test_show_source_link_false(tmp_path, plot_html_show_source_link):
187187

188188

189189
deftest_srcset_version(tmp_path):
190-
shutil.copytree(Path(__file__).parent/'tinypages',tmp_path,
190+
shutil.copytree(Path(__file__).parent/'data/tinypages',tmp_path,
191191
dirs_exist_ok=True)
192192
html_dir=tmp_path/'_build'/'html'
193193
img_dir=html_dir/'_images'

‎lib/matplotlib/tests/test_type1font.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66

77
deftest_Type1Font():
8-
filename=os.path.join(os.path.dirname(__file__),'cmr10.pfb')
8+
filename=os.path.join(os.path.dirname(__file__),'data','cmr10.pfb')
99
font=t1f.Type1Font(filename)
1010
slanted=font.transform({'slant':1})
1111
condensed=font.transform({'extend':0.5})
@@ -78,7 +78,7 @@ def test_Type1Font():
7878

7979

8080
deftest_Type1Font_2():
81-
filename=os.path.join(os.path.dirname(__file__),
81+
filename=os.path.join(os.path.dirname(__file__),'data',
8282
'Courier10PitchBT-Bold.pfb')
8383
font=t1f.Type1Font(filename)
8484
assertfont.prop['Weight']=='Bold'
@@ -137,7 +137,7 @@ def test_tokenize_errors():
137137
deftest_overprecision():
138138
# We used to output too many digits in FontMatrix entries and
139139
# ItalicAngle, which could make Type-1 parsers unhappy.
140-
filename=os.path.join(os.path.dirname(__file__),'cmr10.pfb')
140+
filename=os.path.join(os.path.dirname(__file__),'data','cmr10.pfb')
141141
font=t1f.Type1Font(filename)
142142
slanted=font.transform({'slant':.167})
143143
lines=slanted.parts[0].decode('ascii').splitlines()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp