Skip to main content

Codex plugin and CLI for mocking shell-like tool calls in skill and agent tests.

Project description

codex-tool-mock

PyPI

Codex tool mocking plugin and CLI. Useful for testing and evaluating skills on Codex by mocking shell-like tool calls and asserting that expected commands were used.

See docs/usage.md for setup and usage, docs/publishing.md for PyPI publishing, and SPEC.md for the MVP behavior and milestone plan.

MVP

  • Shell-like Bash hook support.
  • Exact and regex command matching.
  • Static mocked stdout/stderr/exit code responses.
  • Python responder scripts executed through uv run --script, including uv inline dependency metadata.
  • Project-local fixtures and recordings under .codex/tool-mocks/.
  • Pytest-style verification helpers.

Install With uv

For normal use, install the CLI as a persistent uv tool:

uv tool install codex-tool-mock
codex-tool-mock --help

Then install the Codex plugin globally:

codex-tool-mock install-global

This is the recommended uv workflow because Codex hooks will keep using the Python environment created by uv tool install.

To install from a local checkout instead of a package index:

uv tool install .
codex-tool-mock install-global

To try the CLI without installing it persistently:

uvx --from codex-tool-mock codex-tool-mock --help

If you use uvx to install the Codex plugin, make the hook re-run through uvx so it does not depend on the temporary uvx environment:

uvx --from codex-tool-mock codex-tool-mock install-global --hook-runner uvx

For local development from this checkout:

uv sync
uv run codex-tool-mock --help
uv run codex-tool-mock install-global

Install With pip

Install from a package index with pip:

pip install codex-tool-mock
codex-tool-mock --help

Initialize mock storage in the project you want to test:

codex-tool-mock init

Then add fixtures:

codex-tool-mock add-shell --id git-status --command "git status --short" --stdout "" --exit-code 0

To install the Codex plugin globally after a persistent pip or uv tool install:

codex-tool-mock install-global

The installer copies the plugin into ~/.codex/plugins/cache/debug/codex-tool-mock/local and enables these entries in ~/.codex/config.toml. The installed hook command uses the Python environment that ran the installer, so the package must remain installed there.

[features]
plugins = true
plugin_hooks = true

[plugins."codex-tool-mock@debug"]
enabled = true

You can preview target paths without writing files:

codex-tool-mock install-global --dry-run

More examples are in docs/usage.md.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

codex_tool_mock-0.1.0.tar.gz (21.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

codex_tool_mock-0.1.0-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file codex_tool_mock-0.1.0.tar.gz.

File metadata

  • Download URL: codex_tool_mock-0.1.0.tar.gz
  • Upload date:
  • Size: 21.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for codex_tool_mock-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f32a147fb607f9386f14c36850e6f3ad16459230edc665ddd45de3776ff61ae5
MD5 78627a345fa4e343f1e6f109ccd49e31
BLAKE2b-256 8c3ea8caeb89502f5edade448a6042ab4eb50b29929282a02b4082260d8a2fec

See more details on using hashes here.

Provenance

The following attestation bundles were made for codex_tool_mock-0.1.0.tar.gz:

Publisher: publish-pypi.yml on DengYiping/codex-tool-mock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file codex_tool_mock-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: codex_tool_mock-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for codex_tool_mock-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 61a47384375ab75d233552a05e12ae698653271dee207715a9f81ab617e9dbb3
MD5 69015f71783b8971080cd3007565290f
BLAKE2b-256 d752e1522375d3a058fb1871a9303ce33e50f7c9448ce12441a04b34862be07c

See more details on using hashes here.

Provenance

The following attestation bundles were made for codex_tool_mock-0.1.0-py3-none-any.whl:

Publisher: publish-pypi.yml on DengYiping/codex-tool-mock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page