from __future__ import annotations import argparse from pathlib import Path import pytest from metin_release.commands import inspect from metin_release.errors import SourceNotFoundError from metin_release.workspace import Context def test_inspect_tiny_client(tiny_client: Path): ctx = Context() args = argparse.Namespace(source=tiny_client) result = inspect.run(ctx, args) stats = result.data["stats"] assert stats["file_count"] == 5 assert stats["launcher_present"] is True assert stats["main_exe_present"] is True assert stats["total_bytes"] > 0 assert stats["source_path"] == str(tiny_client) def test_inspect_missing_source(tmp_path): ctx = Context() args = argparse.Namespace(source=tmp_path / "nope") with pytest.raises(SourceNotFoundError): inspect.run(ctx, args) def test_inspect_skips_excluded(tmp_path): (tmp_path / "Metin2.exe").write_text("x") (tmp_path / "Metin2Launcher.exe").write_text("y") log_dir = tmp_path / "log" log_dir.mkdir() (log_dir / "should_skip.txt").write_text("nope") (tmp_path / "foo.pdb").write_text("nope") ctx = Context() args = argparse.Namespace(source=tmp_path) result = inspect.run(ctx, args) assert result.data["stats"]["file_count"] == 2