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

Move test data into a single subdirectory#30061

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
timhoffm merged 1 commit intomatplotlib:mainfromQuLogic:test-data-dir
May 21, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion.pre-commit-config.yaml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,7 +10,7 @@ exclude: |
doc/devel/gitwash|
doc/users/prev|
doc/api/prev|
lib/matplotlib/tests/tinypages
lib/matplotlib/tests/data/tinypages
)
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand Down
File renamed without changes.
File renamed without changes.
9 changes: 2 additions & 7 deletionslib/matplotlib/tests/meson.build
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -99,11 +99,6 @@ py3.install_sources(python_sources,

install_data(
'README',
'Courier10PitchBT-Bold.pfb',
'cmr10.pfb',
'mpltest.ttf',
'test_nbagg_01.ipynb',
'test_inline_01.ipynb',
install_tag: 'tests',
install_dir: py3.get_install_dir(subdir: 'matplotlib/tests/'))

Expand All@@ -112,6 +107,6 @@ install_subdir(
install_tag: 'tests',
install_dir: py3.get_install_dir(subdir: 'matplotlib/tests'))
install_subdir(
'tinypages',
'data',
install_tag: 'tests',
install_dir: py3.get_install_dir(subdir: 'matplotlib/tests'))
install_dir: py3.get_install_dir(subdir: 'matplotlib/tests/'))
2 changes: 1 addition & 1 deletionlib/matplotlib/tests/test_backend_inline.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,7 +13,7 @@


def test_ipynb():
nb_path = Path(__file__).parent / 'test_inline_01.ipynb'
nb_path = Path(__file__).parent / 'data/test_inline_01.ipynb'

with TemporaryDirectory() as tmpdir:
out_path = Path(tmpdir, "out.ipynb")
Expand Down
2 changes: 1 addition & 1 deletionlib/matplotlib/tests/test_backend_nbagg.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,7 +14,7 @@


def test_ipynb():
nb_path = Path(__file__).parent / 'test_nbagg_01.ipynb'
nb_path = Path(__file__).parent / 'data/test_nbagg_01.ipynb'

with TemporaryDirectory() as tmpdir:
out_path = Path(tmpdir, "out.ipynb")
Expand Down
2 changes: 1 addition & 1 deletionlib/matplotlib/tests/test_backend_pdf.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -425,6 +425,6 @@ def test_truetype_conversion(recwarn):
mpl.rcParams['pdf.fonttype'] = 3
fig, ax = plt.subplots()
ax.text(0, 0, "ABCDE",
font=Path(__file__).with_name("mpltest.ttf"), fontsize=80)
font=Path(__file__).parent / "data/mpltest.ttf", fontsize=80)
ax.set_xticks([])
ax.set_yticks([])
6 changes: 3 additions & 3 deletionslib/matplotlib/tests/test_font_manager.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -164,7 +164,7 @@
# Prepare a temporary user font directory
user_fonts_dir = tmpdir.join('fonts')
user_fonts_dir.ensure(dir=True)
shutil.copyfile(Path(__file__).parent / font_test_file,
shutil.copyfile(Path(__file__).parent /'data' /font_test_file,
user_fonts_dir.join(font_test_file))

with monkeypatch.context() as m:
Expand All@@ -181,7 +181,7 @@
def test_addfont_as_path():
"""Smoke test that addfont() accepts pathlib.Path."""
font_test_file = 'mpltest.ttf'
path = Path(__file__).parent / font_test_file
path = Path(__file__).parent /'data' /font_test_file
try:
fontManager.addfont(path)
added, = (font for font in fontManager.ttflist
Expand DownExpand Up@@ -215,7 +215,7 @@
os.makedirs(user_fonts_dir)

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

Check warning on line 218 in lib/matplotlib/tests/test_font_manager.py

View check run for this annotation

Codecov/ codecov/patch

lib/matplotlib/tests/test_font_manager.py#L218

Added line #L218 was not covered by tests

# Now, the font should be available
fonts = findSystemFonts()
Expand Down
2 changes: 1 addition & 1 deletionlib/matplotlib/tests/test_mathtext.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -437,7 +437,7 @@ def test_mathtext_fallback_invalid():
("stix", ['DejaVu Sans', 'mpltest', 'STIXGeneral', 'STIXGeneral', 'STIXGeneral'])])
def test_mathtext_fallback(fallback, fontlist):
mpl.font_manager.fontManager.addfont(
str(Path(__file__).resolve().parent / 'mpltest.ttf'))
(Path(__file__).resolve().parent / 'data/mpltest.ttf'))
mpl.rcParams["svg.fonttype"] = 'none'
mpl.rcParams['mathtext.fontset'] = 'custom'
mpl.rcParams['mathtext.rm'] = 'mpltest'
Expand Down
27 changes: 12 additions & 15 deletionslib/matplotlib/tests/test_sphinxext.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,6 +13,9 @@
pytest.importorskip('sphinx', minversion='4.1.3')


tinypages = Path(__file__).parent / 'data/tinypages'


def build_sphinx_html(source_dir, doctree_dir, html_dir, extra_args=None):
# Build the pages with warnings turned into errors
extra_args = [] if extra_args is None else extra_args
Expand All@@ -33,15 +36,13 @@ def build_sphinx_html(source_dir, doctree_dir, html_dir, extra_args=None):


def test_tinypages(tmp_path):
shutil.copytree(Path(__file__).parent / 'tinypages', tmp_path,
dirs_exist_ok=True)
shutil.copytree(tinypages, tmp_path, dirs_exist_ok=True)
html_dir = tmp_path / '_build' / 'html'
img_dir = html_dir / '_images'
doctree_dir = tmp_path / 'doctrees'
# Build the pages with warnings turned into errors
cmd = [sys.executable, '-msphinx', '-W', '-b', 'html',
'-d', str(doctree_dir),
str(Path(__file__).parent / 'tinypages'), str(html_dir)]
'-d', str(doctree_dir), str(tinypages), str(html_dir)]
# On CI, gcov emits warnings (due to agg headers being included with the
# same name in multiple extension modules -- but we don't care about their
# coverage anyways); hide them using GCOV_ERROR_FILE.
Expand DownExpand Up@@ -125,9 +126,8 @@ def plot_directive_file(num):


def test_plot_html_show_source_link(tmp_path):
parent = Path(__file__).parent
shutil.copyfile(parent / 'tinypages/conf.py', tmp_path / 'conf.py')
shutil.copytree(parent / 'tinypages/_static', tmp_path / '_static')
shutil.copyfile(tinypages / 'conf.py', tmp_path / 'conf.py')
shutil.copytree(tinypages / '_static', tmp_path / '_static')
doctree_dir = tmp_path / 'doctrees'
(tmp_path / 'index.rst').write_text("""
.. plot::
Expand All@@ -150,9 +150,8 @@ def test_plot_html_show_source_link(tmp_path):
def test_show_source_link_true(tmp_path, plot_html_show_source_link):
# Test that a source link is generated if :show-source-link: is true,
# whether or not plot_html_show_source_link is true.
parent = Path(__file__).parent
shutil.copyfile(parent / 'tinypages/conf.py', tmp_path / 'conf.py')
shutil.copytree(parent / 'tinypages/_static', tmp_path / '_static')
shutil.copyfile(tinypages / 'conf.py', tmp_path / 'conf.py')
shutil.copytree(tinypages / '_static', tmp_path / '_static')
doctree_dir = tmp_path / 'doctrees'
(tmp_path / 'index.rst').write_text("""
.. plot::
Expand All@@ -170,9 +169,8 @@ def test_show_source_link_true(tmp_path, plot_html_show_source_link):
def test_show_source_link_false(tmp_path, plot_html_show_source_link):
# Test that a source link is NOT generated if :show-source-link: is false,
# whether or not plot_html_show_source_link is true.
parent = Path(__file__).parent
shutil.copyfile(parent / 'tinypages/conf.py', tmp_path / 'conf.py')
shutil.copytree(parent / 'tinypages/_static', tmp_path / '_static')
shutil.copyfile(tinypages / 'conf.py', tmp_path / 'conf.py')
shutil.copytree(tinypages / '_static', tmp_path / '_static')
doctree_dir = tmp_path / 'doctrees'
(tmp_path / 'index.rst').write_text("""
.. plot::
Expand All@@ -187,8 +185,7 @@ def test_show_source_link_false(tmp_path, plot_html_show_source_link):


def test_srcset_version(tmp_path):
shutil.copytree(Path(__file__).parent / 'tinypages', tmp_path,
dirs_exist_ok=True)
shutil.copytree(tinypages, tmp_path, dirs_exist_ok=True)
html_dir = tmp_path / '_build' / 'html'
img_dir = html_dir / '_images'
doctree_dir = tmp_path / 'doctrees'
Expand Down
6 changes: 3 additions & 3 deletionslib/matplotlib/tests/test_type1font.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,7 +5,7 @@


def test_Type1Font():
filename = os.path.join(os.path.dirname(__file__), 'cmr10.pfb')
filename = os.path.join(os.path.dirname(__file__), 'data', 'cmr10.pfb')
font = t1f.Type1Font(filename)
slanted = font.transform({'slant': 1})
condensed = font.transform({'extend': 0.5})
Expand DownExpand Up@@ -78,7 +78,7 @@ def test_Type1Font():


def test_Type1Font_2():
filename = os.path.join(os.path.dirname(__file__),
filename = os.path.join(os.path.dirname(__file__), 'data',
'Courier10PitchBT-Bold.pfb')
font = t1f.Type1Font(filename)
assert font.prop['Weight'] == 'Bold'
Expand DownExpand Up@@ -137,7 +137,7 @@ def test_tokenize_errors():
def test_overprecision():
# We used to output too many digits in FontMatrix entries and
# ItalicAngle, which could make Type-1 parsers unhappy.
filename = os.path.join(os.path.dirname(__file__), 'cmr10.pfb')
filename = os.path.join(os.path.dirname(__file__), 'data', 'cmr10.pfb')
font = t1f.Type1Font(filename)
slanted = font.transform({'slant': .167})
lines = slanted.parts[0].decode('ascii').splitlines()
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp