Skip to content

Commit c31dedb

Browse files
authored
Remove warning for single image in subdir (#234)
1 parent f1fe00c commit c31dedb

File tree

2 files changed

+0
-35
lines changed

2 files changed

+0
-35
lines changed

pytest_pyvista/doc_mode.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,6 @@ def max_vtksz_file_size(request: pytest.FixtureRequest) -> _VtkszFileSizeTestCas
456456
def test_images(_pytest_pyvista_test_case: _DocVerifyImageCache, doc_verify_image_cache: _DocVerifyImageCache) -> None: # noqa: PT019, ARG001
457457
"""Compare generated image with cached image."""
458458
test_case = _pytest_pyvista_test_case
459-
_warn_cached_image_path(test_case.cached_image_path)
460459
fail_msg, fail_source = _test_both_images_exist(
461460
filename=test_case.test_name, docs_image_path=test_case.test_image_path, cached_image_path=test_case.cached_image_path
462461
)
@@ -550,21 +549,6 @@ def has_no_images(path: Path | None) -> bool:
550549
return None, None
551550

552551

553-
def _warn_cached_image_path(cached_image_path: Path | None) -> None:
554-
"""Warn if a subdir is used with only one cached image."""
555-
if cached_image_path is not None and cached_image_path.is_dir():
556-
cached_images = _get_file_paths(cached_image_path, ext=_DocVerifyImageCache.image_format)
557-
if len(cached_images) == 1:
558-
cache_dir = _DocVerifyImageCache.image_cache_dir
559-
rel_path = cache_dir.name / cached_images[0].relative_to(cache_dir)
560-
msg = (
561-
"Cached image sub-directory only contains a single image.\n"
562-
f"Move the cached image {rel_path.as_posix()!r} directly to the cached image dir {cache_dir.name!r}\n"
563-
f"or include more than one image in the sub-directory."
564-
)
565-
warnings.warn(msg, stacklevel=2)
566-
567-
568552
def test_vtksz_file_size(_pytest_pyvista_test_case_vtksz: _VtkszFileSizeTestCase, max_vtksz_file_size: _VtkszFileSizeTestCase) -> None: # noqa: PT019, ARG001
569553
"""Test vtksz file size is less than max allowed."""
570554
test_case = _pytest_pyvista_test_case_vtksz

tests/test_doc_mode.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -299,25 +299,6 @@ def test_multiple_cache_images(pytester: pytest.Pytester, build_color, return_co
299299
assert file_has_changed(str(from_build), str(from_cache))
300300

301301

302-
def test_single_cache_image_in_subdir(pytester: pytest.Pytester) -> None:
303-
"""Test that a warning is emitting for a cache subdir with only one image."""
304-
cache = "cache"
305-
images = "images"
306-
subdir = "imcache"
307-
make_cached_images(pytester.path / cache, subdir)
308-
make_cached_images(pytester.path, images)
309-
_preprocess_build_images(pytester.path / cache / subdir, pytester.path / cache / subdir)
310-
311-
result = pytester.runpytest("--doc_mode", "--doc_images_dir", images, "--image_cache_dir", cache)
312-
assert result.ret == pytest.ExitCode.OK
313-
match = [
314-
".*UserWarning: Cached image sub-directory only contains a single image.",
315-
".*Move the cached image 'cache/imcache/imcache.png' directly to the cached image dir 'cache'",
316-
".*or include more than one image in the sub-directory.",
317-
]
318-
result.stdout.re_match_lines(match)
319-
320-
321302
@pytest.mark.parametrize("include_vtksz", [True, False])
322303
def test_multiple_cache_images_parallel(pytester: pytest.Pytester, include_vtksz) -> None:
323304
"""Ensure that doc_mode works with multiple workers."""

0 commit comments

Comments
 (0)