Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
14 changes: 12 additions & 2 deletions tests/python/io_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

@dataclass(frozen=True)
class PolusTestDataRepo:
repo_url: str = "https://github.com/sameeul/polus-test-data.git"
repo_url: str = "https://github.com/sameeul//polus-test-data.git"

Copilot AI Feb 23, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The URL contains a double slash ('//') between the username and repository name. This should be a single slash: 'https://github.com/sameeul/polus-test-data.git'.

Suggested change
repo_url: str = "https://github.com/sameeul//polus-test-data.git"
repo_url: str = "https://github.com/sameeul/polus-test-data.git"

Copilot uses AI. Check for mistakes.
repo_dir: Path = Path("polus-test-data")
default_branch: str = "main"

Expand All @@ -21,7 +21,17 @@ def ensure_repo_cloned(repo: PolusTestDataRepo, depth: int = 1) -> Path:

repo.repo_dir.parent.mkdir(parents=True, exist_ok=True)
subprocess.run(
["git", "clone", "--depth", str(depth), repo.repo_url, str(repo.repo_dir)],
[
"git",
"clone",
"--branch",
repo.default_branch,
"--single-branch",
"--depth",
str(depth),
repo.repo_url,
str(repo.repo_dir),
],
check=True,
)
return repo.repo_dir
Expand Down
2 changes: 1 addition & 1 deletion tests/python/multi_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def generate_pyramid_from_repo_path(
Clone the repo if needed, locate the image file, then run Argolid pyramid generation.
"""
repo_dir = ensure_repo_cloned(repo)
input_dir = str(repo_dir / "argolid")
input_dir = str(repo_dir / "argolid" / "2D")

output_dir = Path(output_dir)
output_dir.parent.mkdir(parents=True, exist_ok=True)
Expand Down
2 changes: 1 addition & 1 deletion tests/python/test_single_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test_single_image_pyramid(tmp_path: Path) -> None:

generate_pyramid_from_repo_file(
repo=repo,
rel_image_path=Path("argolid") / "x0_y0_c1.ome.tiff",
rel_image_path=Path("argolid") / "2D" / "x0_y0_c1.ome.tiff",
output_dir=out_dir,
)

Expand Down
57 changes: 57 additions & 0 deletions tests/python/test_volume_generator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
from pathlib import Path

import pytest

from argolid import VolumeGenerator
from .io_utils import ensure_repo_cloned, PolusTestDataRepo


@pytest.mark.parametrize(
"file_pattern,output_dir,image_name,group_by",
[
("{z:d}.c{c:d}.ome.tiff", "volume_full", "test_volume", "c"),
],
)
def test_generate_volume_creates_output(
tmp_path: Path,
file_pattern: str,
output_dir: str,
image_name: str,
group_by: str,
) -> None:

repo = PolusTestDataRepo()
repo_dir = ensure_repo_cloned(repo)

input_dir = repo_dir / "argolid" / "3D"
assert input_dir.is_dir(), f"Missing test data dir: {input_dir}"

out_dir = tmp_path / output_dir

vg = VolumeGenerator(
source_dir=str(input_dir),
group_by=group_by,
file_pattern=file_pattern,
out_dir=str(out_dir),
image_name=image_name,
)

vg.generate_volume()

root = out_dir / image_name
assert root.is_dir(), f"Expected output root dir: {root}"

base_scale = root / "0"
assert base_scale.is_dir(), f"Expected base scale dir: {base_scale}"

# zarr markers
zarr_markers = [
root / ".zgroup",
root / ".zattrs",
base_scale / ".zgroup",
base_scale / ".zattrs",
]
assert any(p.exists() for p in zarr_markers), (
"Expected at least one zarr metadata marker (.zgroup/.zattrs) "
f"under {root} or {base_scale}"
)
Loading