Liking cljdoc? Tell your friends :D
Clojure only.

com.blockether.vis.internal.foundation.shim-pytest

Built-in sandbox SHIM: a pytest-compatible module for the model's Python sandbox, implemented PURELY in Python on the stdlib (ast, inspect, linecache, traceback, warnings, tempfile) — NO host/JVM bridge, NOT a line of Clojure or babashka. pytest is a third-party wheel that does not ship in GraalPy, so agents writing full Python extensions and wanting to TEST them inline would otherwise hit ModuleNotFoundError; this extension contributes a :ext/sandbox-shims entry that env-python/build-agent-context installs into every sandbox Context (main + every sub_loop fork).

It is NOT real pytest: there is no pluggy/plugin system, no conftest.py file discovery, no CLI, and no import-time assertion rewrite. Instead it implements the subset that matters in an inline sandbox where the model writes tests + pytest.main() in ONE block:

  • collection of test_* functions and Test* classes (scoped to the CURRENT block via __vis_src__, so leftovers from earlier blocks in the shared globals are NOT swept in),
  • RUNTIME assert introspection (assert 2 == 3 reconstructed with operand values) done by registering __vis_src__ into linecache and walking the failing frame's AST — the same UX as pytest's rewrite, via a different mechanism,
  • pytest.raises / warns / approx / fail / skip / xfail / importorskip, @pytest.fixture (function/module/session scope, yield-teardown, autouse, recursive injection), @pytest.mark.parametrize / skip / skipif / xfail (+ arbitrary marks), pytest.param, builtin fixtures request / monkeypatch / capsys / capfd / tmp_path, and a pytest.main() runner that prints progress + failure reports + a summary line and returns an exit code.

Unlike shim-yaml/shim-matplotlib there are NO :shim/bindings: the shim is a self-contained Python preamble with zero host callables. It publishes a pytest module into sys.modules (so import pytest works) and staples it onto builtins (so pytest.raises(...) works with NO import, like json/os/requests).

Built-in sandbox SHIM: a `pytest`-compatible module for the model's Python
sandbox, implemented PURELY in Python on the stdlib (`ast`, `inspect`,
`linecache`, `traceback`, `warnings`, `tempfile`) — NO host/JVM bridge, NOT a
line of Clojure or babashka. `pytest` is a third-party wheel that does not
ship in GraalPy, so agents writing full Python extensions and wanting to
TEST them inline would otherwise hit ModuleNotFoundError; this extension
contributes a `:ext/sandbox-shims` entry that
`env-python/build-agent-context` installs into every sandbox Context (main +
every `sub_loop` fork).

It is NOT real pytest: there is no pluggy/plugin system, no `conftest.py`
file discovery, no CLI, and no import-time assertion rewrite. Instead it
implements the subset that matters in an inline sandbox where the model
writes tests + `pytest.main()` in ONE block:

  - collection of `test_*` functions and `Test*` classes (scoped to the
    CURRENT block via `__vis_src__`, so leftovers from earlier blocks in the
    shared globals are NOT swept in),
  - RUNTIME assert introspection (`assert 2 == 3` reconstructed with operand
    values) done by registering `__vis_src__` into `linecache` and walking
    the failing frame's AST — the same UX as pytest's rewrite, via a
    different mechanism,
  - `pytest.raises` / `warns` / `approx` / `fail` / `skip` / `xfail` /
    `importorskip`, `@pytest.fixture` (function/module/session scope,
    yield-teardown, autouse, recursive injection), `@pytest.mark.parametrize`
    / `skip` / `skipif` / `xfail` (+ arbitrary marks), `pytest.param`,
    builtin fixtures `request` / `monkeypatch` / `capsys` / `capfd` /
    `tmp_path`, and a `pytest.main()` runner that prints progress + failure
    reports + a summary line and returns an exit code.

Unlike `shim-yaml`/`shim-matplotlib` there are NO `:shim/bindings`: the shim
is a self-contained Python preamble with zero host callables. It publishes a
`pytest` module into `sys.modules` (so `import pytest` works) and staples it
onto builtins (so `pytest.raises(...)` works with NO import, like
json/os/requests).
raw docstring

vis-extensionclj

source

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close