Skip to main content

cot-assert

Assertion rewriting that raises a structured AnnotatedAssertion, for Python 2.7, Python 3.9+ and RPython. Intended as a drop-in replacement for pytest's assertion rewriting on current pytest and on pytest 4.6.

Pre-alpha.

pip install cot-assert

One universal wheel serves Python 2.7 (pip 20 and later, CPython or PyPy) and Python 3.9 and later. It has no dependencies.

With pytest

Installing the package registers a pytest plugin that stays off until enabled:

[pytest]
cot_assert = true
# where a failed assert's explanation goes: message (default) or notes
cot_assert_finalize = message

or pytest --cot-assert. On Python 2.7, where it runs from source, load it with -p cot_assert.pytest_plugin.

pytest still decides which modules are rewritten (test files, conftests, pytest.register_assert_rewrite) and caches them under a separate name; cot_assert does the rewriting, and failures render through pytest's own comparison hooks. Failures show as AnnotatedAssertion instead of AssertionError. --assert=plain turns rewriting off for both.

Without pytest

import cot_assert

cot_assert.install(["mypackage", "test_*"])

rewrites modules imported afterwards whose name matches.

Metadata

Release files for cot-assert 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cot-assert 0.2.0
File Size Uploaded
cot_assert-0.2.0.tar.gz 51.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cot-assert 0.2.0
File Interpreter ABI Platform
cot_assert-0.2.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 80.1 kB

Release files / cot_assert-0.2.0.tar.gz

Download URL cot_assert-0.2.0.tar.gz
Size 51.0 kB
Tags Source
SHA-256 checksum
How to use checksums
6f8356f37d28f2477ff343c523802069e8a149cafe4bfcad86876871fef8f741
BLAKE2b-256 checksum
How to use checksums
836c4e3d947d3a85a20681c915e310d7c8b9832f285e8d11aef79eee1449b338
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.

Transparency log

Release files / cot_assert-0.2.0-py2.py3-none-any.whl

Download URL cot_assert-0.2.0-py2.py3-none-any.whl
Size 29.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
cc8da26b14f3c7ebd215ae90a7b209910b53889c7f520c60dff808f5bbee8618
BLAKE2b-256 checksum
How to use checksums
01888124c095bbdbac8fa02fa41cfac273eba67779307a8e6a86a63d622e9f9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.

Transparency log

Release history Release notifications | RSS feed

0.2.1

2 release files

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page