pytest-codex
Building toward pytest-native tests for what Codex actually does.
Status: 0.0.1 core preview
This initial release provides working utilities for parsing the JSONL output
of codex exec --json and detecting file changes with before/after snapshots.
It does not register a pytest plugin yet. The codex fixture, command runner,
record/replay, and repeated-run pass-rate checks are under development and are
not available in this version. No Codex calls are made by installing or importing
this package.
Requires Python 3.10 or newer.
Parse a saved execution trace
from pathlib import Path
from pytest_codex.events import Command, build_items, parse_jsonl, total_usage
events = parse_jsonl(Path("trace.jsonl").read_text(encoding="utf-8"))
for item in build_items(events):
if isinstance(item, Command):
print(item.command, item.exit_code)
print(total_usage(events).total)
The parser removes common shell wrappers from command strings and preserves unknown item types as raw data. Token totals count input plus output tokens; cached input tokens are already part of input and are not added again.
Detect file changes
from pathlib import Path
from pytest_codex.snapshot import snapshot, diff
root = Path("my-project")
before = snapshot(root)
# Run your own operation that changes files here.
after = snapshot(root)
print(diff(before, after).to_dict())
Snapshots detect edits performed through shell commands as well as direct file
edits. Common generated directories such as .git and .venv are excluded.
Development
Run the core smoke tests from a source checkout:
python -m pip install .
python -m unittest discover -s tests -v
The repository URL is https://github.com/Czj027/pytest-codex.
The GitHub repository itself may not be publicly available yet.
MIT licensed. Independent community project; not an official OpenAI package.
中文说明
0.0.1 是有实际功能的核心预览版:包含 Codex JSONL 事件解析和文件变更快照。 pytest fixture、录制/回放和多次运行通过率统计尚未实现,本版本不会注册 pytest 插件。 安装和导入不会调用 Codex,也不会消耗模型额度。
Metadata
Release files for pytest-codex 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pytest_codex-0.0.1.tar.gz | 6.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_codex-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.4 kB
Release files / pytest_codex-0.0.1.tar.gz
| Download URL | pytest_codex-0.0.1.tar.gz |
|---|---|
| Size | 6.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
afa3954fdf3004789ea71b9f1d238899c5181205081e5aee6543b5d3c3170f66
|
|
BLAKE2b-256 checksum How to use checksums |
e10b9d39363617d86a557795ec4df0bcee0c60224ae91cb3c402b71cdb03f6e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / pytest_codex-0.0.1-py3-none-any.whl
| Download URL | pytest_codex-0.0.1-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
95bf2d7d696db74745e6a694c6f7b92822f75bb994ebdb97a207fd5f68029eb5
|
|
BLAKE2b-256 checksum How to use checksums |
f6c9134c867d8347b55f81d90829b9e00bd622dd3381afa0395f261e74c1f559
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for pytest-codex 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.