- integrations
- Python
- ocx_sdk
PackageCommands (16 of 16)
PackageCommandsclassdataclass#
Re-exported from
ocx_sdk._clientView sourcetestmethod#
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) -> TestResultMaterialize 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
| Name | Type | Default | Description |
|---|---|---|---|
identifier | str | required | The identifier to materialize under. Tag form only. |
script | str | Path | required | Path to the Starlark test script, or - to read the
script source from stdin. |
layers | Iterable[str | Path] | () | Layer archives or digest references, base first. |
platform | str | None | None | The platform to resolve against. Omitted reads the build receipt beside the bundle. |
metadata | str | Path | None | None | The compiled metadata sidecar. Required when no file layers are given. |
output | str | Path | None | None | Where to materialize the package. None uses ocx’s
temp root under $OCX_HOME. |
keep | bool | False | Preserve the temporary build directory. |
clean | bool | False | Strip the ambient parent environment before composing. |
private | bool | False | Compose the private surface — ocx’s --self. |
env | Mapping[str, EnvValue] | None | None | Extra [env] entries for this call. |
timeout | MaybeTimeout | UNSET | Seconds per attempt. Omitted takes the config’s. |
retry | MaybeRetry | UNSET | Retry policy. None opts out; omitted takes the config’s. |
Returns
TestResult- The outcome:
statusdecides, andassertion.kindis 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.