Pytest plugin for the Pico ecosystem: isolated containers by default and a make_container fixture.
Project description
pico-testing
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=falseis 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.
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 toinit(modules=[...]).config: a plain dict (wrapped inconfiguration(DictSource(...))) or a readyconfiguration(...)object.boot=True: usepico_boot.initinstead ofpico_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)
Documentation
Full documentation: https://dperezcabrera.github.io/pico-testing/
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pico_testing-0.1.0.tar.gz.
File metadata
- Download URL: pico_testing-0.1.0.tar.gz
- Upload date:
- Size: 15.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b87410da32ea7fdfe2a5df2131cf2e3ffc411b263373689307db9777c5150ac
|
|
| MD5 |
7829d59bcdbb0036cd2099c403883653
|
|
| BLAKE2b-256 |
01b391df831bd475798fdb5bd20efaf736f4c3fbca8e0a2fb609612c25d6c83e
|
Provenance
The following attestation bundles were made for pico_testing-0.1.0.tar.gz:
Publisher:
publish-to-pypi.yml on dperezcabrera/pico-testing
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pico_testing-0.1.0.tar.gz -
Subject digest:
0b87410da32ea7fdfe2a5df2131cf2e3ffc411b263373689307db9777c5150ac - Sigstore transparency entry: 2137503878
- Sigstore integration time:
-
Permalink:
dperezcabrera/pico-testing@68689a55b7a0f2ffc44269262159e386fb3c06de -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/dperezcabrera
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@68689a55b7a0f2ffc44269262159e386fb3c06de -
Trigger Event:
release
-
Statement type:
File details
Details for the file pico_testing-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pico_testing-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ac8720e31020d6087afeb13302df24186fc15fba94a68d510f4cd41a9c7fc40
|
|
| MD5 |
44439883128be1e3590a44217f650c23
|
|
| BLAKE2b-256 |
4685ea6f070a00cc6281c6b8e93577bc627b5cdd2953bb4e46d5cabb4cb00ee1
|
Provenance
The following attestation bundles were made for pico_testing-0.1.0-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on dperezcabrera/pico-testing
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pico_testing-0.1.0-py3-none-any.whl -
Subject digest:
6ac8720e31020d6087afeb13302df24186fc15fba94a68d510f4cd41a9c7fc40 - Sigstore transparency entry: 2137504088
- Sigstore integration time:
-
Permalink:
dperezcabrera/pico-testing@68689a55b7a0f2ffc44269262159e386fb3c06de -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/dperezcabrera
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@68689a55b7a0f2ffc44269262159e386fb3c06de -
Trigger Event:
release
-
Statement type: