🔒 Repository is read-only – file editing is disabled.

PaganLinux/tmp-selftest.py main

12 linii Raw ← Powrót
123456789101112
import sys, os, tempfile
src = open(sys.argv[1], encoding="utf-8").read()
idx = src.find('if __name__ == "__main__":')
ns = {"__file__": os.path.abspath(sys.argv[1]), "__name__": "pag"}
exec(compile(src[:idx], "pag", "exec"), ns)
ns["GPG_BINARY"] = "/nonexistent/gpg"
ns["GPG_HOME"] = tempfile.mkdtemp()
res = ns["_gpg_run"]("--verify", "a.asc", "b", capture_output=True, text=True, timeout=10)
assert isinstance(res.stderr, str), "stderr nie jest str!"
ok, fp = ns["_gpg_verify_fp"]("a.asc", "b")
assert ok is False
print("   OK - brak TypeError przy braku gpg")