Skip to main content

charms.unit_test

This library provides helpers for unit testing reactive style charms, layers, and interfaces.

Usage

This library is intended to be used with pytest and conftest.py, which allows for mocking out imports prior to the test code being loaded.

Example conftest.py:

from charms.unit_test import patch_reactive, patch_module

# patch common things needed by any reactive charm
patch_reactive()

# patch some other module that the charm expects to be there
patch_module('charms.leadership')

With this, your test code can import the charm's reactive code which depends on charms.reactive and charmhelpers without error, and the libraries will be mocked out so that you can call your handlers directly to test them.

Reference

More details on what is patched, as well as what other helpers are available, can be found in the reference docs.

Metadata

Release files for charms.unit-test 1.1.2

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

Source distribution (sdist)

Source distribution for charms.unit-test 1.1.2
File Size Uploaded Provenance
charms.unit_test-1.1.2.tar.gz 5.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for charms.unit-test 1.1.2
File Interpreter ABI Platform
charms.unit_test-1.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 11.1 kB

Release files / charms.unit_test-1.1.2.tar.gz

Download URL charms.unit_test-1.1.2.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5311d7bc9ded480650b089d1ff619d8420ac6188cb1ff2bb918f4885be200f27
BLAKE2b-256 checksum
How to use checksums
e8e57bf6843dee5e645f754e59618f593dcd0fd6fa9123ee756ad51299cc5f20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Release files / charms.unit_test-1.1.2-py3-none-any.whl

Download URL charms.unit_test-1.1.2-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
34975206e2716d7cb96e0f58c943a0071be8e100d4de424ed71f3a2a1a43c7bf
BLAKE2b-256 checksum
How to use checksums
166d421dd9d4b9970660179c2c8dc369dae7a6fd2b3646566b2f7bec55ee2e84
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Security for charms.unit-test 1.1.2

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.

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