Files
MajoorWaldi-ComfyUI-Majoor-…/tests/metadata/test_exiftool_batch_matching.py
T
Ewald 00ee7806f7 feat: Add tool detection helpers for ExifTool and FFprobe
- Implemented caching for tool availability and versions.
- Added functions to check for ExifTool and FFprobe availability.
- Included version satisfaction checks against minimum required versions.
- Created utility functions for parsing boolean and float values from environment variables.
- Introduced shared utilities for error message sanitization and logging with emoji indicators.
- Established a Result pattern for error handling without exceptions.
- Added scan throttling helpers to manage background scans efficiently.
- Implemented time utilities for timestamps and performance measurement.
- Defined shared types, enums, and constants for consistent error handling and file classification.
- Created version management utilities to retrieve version information from pyproject.toml.
- Developed installation script for runtime dependencies.
- Added tests for ExifTool batch processing and various configuration scenarios.
- Implemented tests for version route aliases and runtime output root configuration.
2026-02-12 17:55:28 +01:00

40 lines
956 B
Python

import pytest
import os
from pathlib import Path
from mjr_am_backend.adapters.tools.exiftool import _build_match_map, _normalize_match_path
@pytest.mark.asyncio
async def test_build_match_map_dedupes_identical_paths(tmp_path: Path):
f = tmp_path / "a.txt"
f.write_text("hello", encoding="utf-8")
p = str(f)
key_to_paths, cmd_paths = _build_match_map([p, p])
assert len(cmd_paths) == 1
assert cmd_paths[0] == p
assert len(key_to_paths) == 1
only_key = next(iter(key_to_paths))
assert key_to_paths[only_key] == [p, p]
@pytest.mark.asyncio
async def test_normalize_match_path_is_case_insensitive_on_windows(tmp_path: Path):
f = tmp_path / "MiXeD.txt"
f.write_text("hello", encoding="utf-8")
norm1 = _normalize_match_path(str(f))
assert norm1
if os.name != "nt":
return
upper = str(f).upper()
norm2 = _normalize_match_path(upper)
assert norm2
assert norm1 == norm2