Skip to content
ocx
install

PackageCommands (16 of 16)

PackageCommandsclassdataclass#

Re-exported from ocx_sdk._clientView source

testmethod#

def test(identifier: str, *, script: str | Path, layers: Iterable[str | Path] = (), platform: str | None = None, metadata: str | Path | None = None, output: str | Path | None = None, keep: bool = False, clean: bool = False, private: bool = False, env: Mapping[str, EnvValue] | None = None, timeout: MaybeTimeout = UNSET, retry: MaybeRetry = UNSET) -> TestResult

Materialize a package locally and run a Starlark test script.

Only the --script form is typed. ocx’s trailing -- CMD form prints the child’s stdout verbatim even under --format json, so it produces nothing parseable — reach for invoke if you need it.

Parameters

NameTypeDefaultDescription
identifierstrrequiredThe identifier to materialize under. Tag form only.
scriptstr | PathrequiredPath to the Starlark test script, or - to read the script source from stdin.
layersIterable[str | Path]()Layer archives or digest references, base first.
platformstr | NoneNoneThe platform to resolve against. Omitted reads the build receipt beside the bundle.
metadatastr | Path | NoneNoneThe compiled metadata sidecar. Required when no file layers are given.
outputstr | Path | NoneNoneWhere to materialize the package. None uses ocx’s temp root under $OCX_HOME.
keepboolFalsePreserve the temporary build directory.
cleanboolFalseStrip the ambient parent environment before composing.
privateboolFalseCompose the private surface — ocx’s --self.
envMapping[str, EnvValue] | NoneNoneExtra [env] entries for this call.
timeoutMaybeTimeoutUNSETSeconds per attempt. Omitted takes the config’s.
retryMaybeRetryUNSETRetry policy. None opts out; omitted takes the config’s.

Returns

TestResult
The outcome: status decides, and assertion.kind is the
TestResult
stable machine-readable reason. A failing script is a RESULT
TestResult
(exit 1 still carries the envelope), not an exception — only
TestResult
resolution or usage failures raise.