Skip to main content

pico-testing

PyPI Ask DeepWiki License: MIT CI (tox matrix) codecov Quality Gate Status Duplicated Lines (%) Maintainability Rating PyPI Downloads Docs Interactive Lab

Pytest plugin for the pico ecosystem: isolated containers by default and a make_container fixture with automatic shutdown.

Why

Any pico_boot.init() in a test auto-discovers every pico plugin installed in the venv — so a test suite passes or fails depending on what else happens to be installed. Every pico project ends up copying the same two conftest fixtures. This plugin ships them once:

  • Isolation by default: PICO_BOOT_AUTO_PLUGINS=false is set for every test. Opt back in per-test with @pytest.mark.pico_auto_plugins.
  • make_container: builds containers from explicit modules and config, and shuts them all down on teardown.
  • pico_module: declare the package under test once in your pytest config; make_container() always includes it.
  • make_client: a FastAPI TestClient over a container's app, with the lifespan running and a safe close on teardown.

Installation

pip install pico-testing

No conftest wiring — installing it activates the plugin.

Quick start

import sys

def test_my_service(make_container):
    container = make_container(
        "my_package",
        config={"my_prefix": {"key": "value"}},
    )
    service = container.get(MyService)
    assert service.do_something() == "expected"

make_container(*modules, config=None, boot=False):

  • modules: module objects or import strings, passed to init(modules=[...]).
  • config: a plain dict (wrapped in configuration(DictSource(...))) or a ready configuration(...) object.
  • boot=True: use pico_boot.init instead of pico_ioc.init (plugin auto-discovery still off unless the test is marked).

Re-enable plugin auto-discovery for a single test:

import pytest

@pytest.mark.pico_auto_plugins
def test_full_boot(make_container):
    container = make_container(boot=True)

Module under test

Declare it once and drop it from every call:

# pyproject.toml
[tool.pytest.ini_options]
pico_module = "my_package"
def test_my_service(make_container):
    service = make_container().get(MyService)

Testing HTTP endpoints

With pico-fastapi installed, make_client wraps the container's app in a TestClient with the lifespan running (requires pico-ioc >= 2.3.3):

def test_endpoint(make_container, make_client):
    container = make_container("pico_fastapi", config={"fastapi": {"title": "t"}})
    client = make_client(container)
    assert client.get("/ping").status_code == 200

Documentation

Full documentation: https://dperezcabrera.github.io/pico-testing/

Built for AI-assisted development

pico-testing is part of an ecosystem designed for humans and coding agents building software together — and this plugin IS the agent's verification loop: a change is not done until the isolated, three-line test around it runs green. Every package ships AGENTS.md working conventions, an llms.txt machine-readable docs index and documented behaviour pinned by regression tests, and releases are gated by the whole ecosystem booting together against real infrastructure. The full story: Built for AI-assisted development.

Install the agent skills for Claude Code or OpenAI Codex:

curl -sL https://raw.githubusercontent.com/dperezcabrera/pico-skills/main/install.sh | bash

The pico-conventions skill teaches the assistant this module's API surface and invariants; /add-component and /add-tests scaffold components and tests that use it.

License

MIT

Metadata

Release files for pico-testing 0.2.1

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

Source distribution (sdist)

Source distribution for pico-testing 0.2.1
File Size Uploaded Provenance Actions
pico_testing-0.2.1.tar.gz 24.0 kB With provenance Details for pico_testing-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pico-testing 0.2.1
File Interpreter ABI Platform Actions
pico_testing-0.2.1-py3-none-any.whl Python 3 none any Details for pico_testing-0.2.1-py3-none-any.whl

Total release size: 31.3 kB

Release files / pico_testing-0.2.1.tar.gz

Download URL pico_testing-0.2.1.tar.gz
Size 24.0 kB
Tags Source
SHA-256 checksum
How to use checksums
099364dfd0f1393d9c331f9d11a8a8a362545b800736b3683dd4c6f888217280
BLAKE2b-256 checksum
How to use checksums
fd6149d6ff968b84cbce340b84f221f12a7653b98ad472449502b2268eb40579
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 1, 2026.

Transparency log

Release files / pico_testing-0.2.1-py3-none-any.whl

Download URL pico_testing-0.2.1-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e7883bd40a08b52c25d947d98055db421d99f6eebc801575a8404c2f2f478035
BLAKE2b-256 checksum
How to use checksums
0a7b7c67eb688436dfd58a38d83fbc38713a8eba9415ca082c5b37af05987c09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 1, 2026.

Transparency log

Security for pico-testing 0.2.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pico_testing-0.2.1.tar.gz

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 Nov 1, 2026.

Transparency log

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.

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