Files
remove-ai-watermarks/tests/test_script_help.py
T
Victor Kuznetsov 6c3781a985 Add source restoration tools and record SynthID research
Preserve the frozen offline recipes and their synthetic regression tests.
Recognize wrapped provider errors and separate C2PA signature assertions
from time-dependent certificate validity in static fixture tests.
Isolate the visible-detector contract test from unrelated TrustMark weights.
2026-10-25 13:54:51 -07:00

58 lines
1.6 KiB
Python

"""Basic command-line contracts for standalone maintainer scripts."""
from __future__ import annotations
import subprocess
import sys
from os import environ
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parents[1]
@pytest.mark.parametrize(
"script",
[
"visible_groundtruth.py",
"visible_recall_sample.py",
"visible_sheets.py",
"registered_mark_calibrate.py",
"restore_source_band.py",
"restore_source_detail.py",
"watermark_benchmark.py",
"watermark_benchmark_cohort.py",
"watermark_benchmark_real_cohort.py",
"watermark_benchmark_report.py",
"watermark_benchmark_resources.py",
],
)
def test_script_help_exits_cleanly(script: str) -> None:
result = subprocess.run( # noqa: S603 -- fixed interpreter and repository-owned script path
[sys.executable, str(ROOT / "scripts" / script), "--help"],
cwd=ROOT,
capture_output=True,
text=True,
check=False,
)
assert result.returncode == 0, result.stderr
assert "usage:" in result.stdout
def test_visible_groundtruth_help_is_cp1252_safe() -> None:
env = environ.copy()
env["PYTHONIOENCODING"] = "cp1252"
result = subprocess.run( # noqa: S603 -- fixed interpreter and repository-owned script path
[sys.executable, str(ROOT / "scripts" / "visible_groundtruth.py"), "--help"],
cwd=ROOT,
env=env,
capture_output=True,
text=True,
check=False,
)
assert result.returncode == 0, result.stderr
assert "usage:" in result.stdout