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

Commit9e7106b

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 parent1c84927 commit9e7106b

26 files changed

+25
-33
lines changed

‎.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ exclude: |
1010
doc/devel/gitwash|
1111
doc/users/prev|
1212
doc/api/prev|
13-
lib/matplotlib/tests/tinypages
13+
lib/matplotlib/tests/data/tinypages
1414
)
1515
repos:
1616
-repo:https://github.com/pre-commit/pre-commit-hooks
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: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
pytest.importorskip('sphinx',minversion='4.1.3')
1414

1515

16+
tinypages=Path(__file__).parent/'data/tinypages'
17+
18+
1619
defbuild_sphinx_html(source_dir,doctree_dir,html_dir,extra_args=None):
1720
# Build the pages with warnings turned into errors
1821
extra_args= []ifextra_argsisNoneelseextra_args
@@ -33,15 +36,13 @@ def build_sphinx_html(source_dir, doctree_dir, html_dir, extra_args=None):
3336

3437

3538
deftest_tinypages(tmp_path):
36-
shutil.copytree(Path(__file__).parent/'tinypages',tmp_path,
37-
dirs_exist_ok=True)
39+
shutil.copytree(tinypages,tmp_path,dirs_exist_ok=True)
3840
html_dir=tmp_path/'_build'/'html'
3941
img_dir=html_dir/'_images'
4042
doctree_dir=tmp_path/'doctrees'
4143
# Build the pages with warnings turned into errors
4244
cmd= [sys.executable,'-msphinx','-W','-b','html',
43-
'-d',str(doctree_dir),
44-
str(Path(__file__).parent/'tinypages'),str(html_dir)]
45+
'-d',str(doctree_dir),str(tinypages),str(html_dir)]
4546
# On CI, gcov emits warnings (due to agg headers being included with the
4647
# same name in multiple extension modules -- but we don't care about their
4748
# coverage anyways); hide them using GCOV_ERROR_FILE.
@@ -125,9 +126,8 @@ def plot_directive_file(num):
125126

126127

127128
deftest_plot_html_show_source_link(tmp_path):
128-
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(tinypages/'conf.py',tmp_path/'conf.py')
130+
shutil.copytree(tinypages/'_static',tmp_path/'_static')
131131
doctree_dir=tmp_path/'doctrees'
132132
(tmp_path/'index.rst').write_text("""
133133
.. plot::
@@ -150,9 +150,8 @@ def test_plot_html_show_source_link(tmp_path):
150150
deftest_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.
153-
parent=Path(__file__).parent
154-
shutil.copyfile(parent/'tinypages/conf.py',tmp_path/'conf.py')
155-
shutil.copytree(parent/'tinypages/_static',tmp_path/'_static')
153+
shutil.copyfile(tinypages/'conf.py',tmp_path/'conf.py')
154+
shutil.copytree(tinypages/'_static',tmp_path/'_static')
156155
doctree_dir=tmp_path/'doctrees'
157156
(tmp_path/'index.rst').write_text("""
158157
.. plot::
@@ -170,9 +169,8 @@ def test_show_source_link_true(tmp_path, plot_html_show_source_link):
170169
deftest_show_source_link_false(tmp_path,plot_html_show_source_link):
171170
# Test that a source link is NOT generated if :show-source-link: is false,
172171
# whether or not plot_html_show_source_link is true.
173-
parent=Path(__file__).parent
174-
shutil.copyfile(parent/'tinypages/conf.py',tmp_path/'conf.py')
175-
shutil.copytree(parent/'tinypages/_static',tmp_path/'_static')
172+
shutil.copyfile(tinypages/'conf.py',tmp_path/'conf.py')
173+
shutil.copytree(tinypages/'_static',tmp_path/'_static')
176174
doctree_dir=tmp_path/'doctrees'
177175
(tmp_path/'index.rst').write_text("""
178176
.. plot::
@@ -187,8 +185,7 @@ def test_show_source_link_false(tmp_path, plot_html_show_source_link):
187185

188186

189187
deftest_srcset_version(tmp_path):
190-
shutil.copytree(Path(__file__).parent/'tinypages',tmp_path,
191-
dirs_exist_ok=True)
188+
shutil.copytree(tinypages,tmp_path,dirs_exist_ok=True)
192189
html_dir=tmp_path/'_build'/'html'
193190
img_dir=html_dir/'_images'
194191
doctree_dir=tmp_path/'doctrees'

‎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