nemo_gym.sandbox.testing
nemo_gym.sandbox.testing
A fake sandbox provider for tests of code that owns or borrows sandboxes.
Tests drive a real AsyncSandbox over FakeSandboxProvider, so what the
sandbox guarantees, such as a stop that survives cancellation and is bounded in time, holds in the test as it does in
production. A test scripts the provider, not the sandbox: a slow, failing or hanging stop is a side effect on
provider.on_close.
Module Contents
Classes
Functions
API
An in-memory provider: sandboxes start at once, commands succeed with no output, and nothing leaves the process.
Whether the provider’s client was released (aclose).
The ids of the sandboxes whose close succeeded, in order.
Awaited, with no arguments, every time a sandbox is closed. Give it a side effect to make the provider’s close slow, fail or hang: an async function, or a plain one that raises or returns an awaitable, which the close awaits too.
A started sandbox on provider (a new FakeSandboxProvider by default), built without awaiting.
It is what await AsyncSandbox(provider, spec).start() returns, for tests that need one in a synchronous
fixture, and sandbox.provider is the provider to script. By default the sandbox does not own the provider,
so stopping it leaves the provider’s client open; with owns_provider a successful stop closes it too.