MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / _invoke

Function _invoke

tests/test_hook_strict.py:41–53  ·  view source on GitHub ↗
(kind, payload, tmp_path, monkeypatch, *, strict=False, env=None)

Source from the content-addressed store, hash-verified

39
40
41def _invoke(kind, payload, tmp_path, monkeypatch, *, strict=False, env=None):
42 monkeypatch.chdir(tmp_path)
43 for k, v in (env or {}).items():
44 monkeypatch.setenv(k, v)
45 data = json.dumps(payload).encode() if not isinstance(payload, (bytes, bytearray)) else bytes(payload)
46
47 class _Stdin:
48 buffer = io.BytesIO(data)
49 monkeypatch.setattr(sys, "stdin", _Stdin())
50 buf = io.StringIO()
51 monkeypatch.setattr(sys, "stdout", buf)
52 cli._run_hook_guard(kind, strict=strict)
53 return buf.getvalue()
54
55
56def _read(fpath, sid="s1"):

Calls 2

_StdinClass · 0.70
itemsMethod · 0.45

Tested by

no test coverage detected