Files
metin-release-cli/tests/test_inspect.py
Jan Nedbal d2dd2c88b6 tests: cover phase 1 commands end to end
Pytest suite with a tiny_client fixture, an ephemeral Ed25519 keypair
fixture, and a threaded HTTPServer helper. Exercises cli dispatch,
inspect (including excluded-path handling), build-manifest and sign
against the real m2dev-client scripts, diff-remote via a local server,
and the full release publish composite against a local rsync target.
2026-04-14 18:59:50 +02:00

43 lines
1.3 KiB
Python

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