pico-testing 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. pico_testing-0.1.0/.coveragerc +18 -0
  2. pico_testing-0.1.0/.github/ISSUE_TEMPLATE/bug_report.yml +24 -0
  3. pico_testing-0.1.0/.github/ISSUE_TEMPLATE/feature_request.yml +15 -0
  4. pico_testing-0.1.0/.github/PULL_REQUEST_TEMPLATE.md +13 -0
  5. pico_testing-0.1.0/.github/dependabot.yml +10 -0
  6. pico_testing-0.1.0/.github/workflows/ci.yml +69 -0
  7. pico_testing-0.1.0/.github/workflows/codeql.yml +21 -0
  8. pico_testing-0.1.0/.github/workflows/docs.yml +48 -0
  9. pico_testing-0.1.0/.github/workflows/publish-to-pypi.yml +24 -0
  10. pico_testing-0.1.0/.sonarcloud.properties +3 -0
  11. pico_testing-0.1.0/CHANGELOG.md +15 -0
  12. pico_testing-0.1.0/CODE_OF_CONDUCT.md +35 -0
  13. pico_testing-0.1.0/CONTRIBUTING.md +37 -0
  14. pico_testing-0.1.0/LICENSE +21 -0
  15. pico_testing-0.1.0/MANIFEST.in +5 -0
  16. pico_testing-0.1.0/PKG-INFO +119 -0
  17. pico_testing-0.1.0/README.md +62 -0
  18. pico_testing-0.1.0/SECURITY.md +11 -0
  19. pico_testing-0.1.0/docs/CHANGELOG.md +15 -0
  20. pico_testing-0.1.0/docs/faq.md +17 -0
  21. pico_testing-0.1.0/docs/getting-started.md +52 -0
  22. pico_testing-0.1.0/docs/hooks.py +7 -0
  23. pico_testing-0.1.0/docs/index.md +29 -0
  24. pico_testing-0.1.0/docs/javascripts/extra.js +10 -0
  25. pico_testing-0.1.0/docs/requirements.txt +7 -0
  26. pico_testing-0.1.0/docs/stylesheets/extra.css +53 -0
  27. pico_testing-0.1.0/mkdocs.yml +117 -0
  28. pico_testing-0.1.0/pyproject.toml +77 -0
  29. pico_testing-0.1.0/setup.cfg +4 -0
  30. pico_testing-0.1.0/src/pico_testing/__init__.py +1 -0
  31. pico_testing-0.1.0/src/pico_testing/_version.py +1 -0
  32. pico_testing-0.1.0/src/pico_testing/plugin.py +55 -0
  33. pico_testing-0.1.0/src/pico_testing/py.typed +0 -0
  34. pico_testing-0.1.0/src/pico_testing.egg-info/PKG-INFO +119 -0
  35. pico_testing-0.1.0/src/pico_testing.egg-info/SOURCES.txt +42 -0
  36. pico_testing-0.1.0/src/pico_testing.egg-info/dependency_links.txt +1 -0
  37. pico_testing-0.1.0/src/pico_testing.egg-info/entry_points.txt +2 -0
  38. pico_testing-0.1.0/src/pico_testing.egg-info/requires.txt +8 -0
  39. pico_testing-0.1.0/src/pico_testing.egg-info/scm_file_list.json +40 -0
  40. pico_testing-0.1.0/src/pico_testing.egg-info/scm_version.json +8 -0
  41. pico_testing-0.1.0/src/pico_testing.egg-info/top_level.txt +1 -0
  42. pico_testing-0.1.0/tests/conftest.py +1 -0
  43. pico_testing-0.1.0/tests/test_plugin.py +143 -0
  44. pico_testing-0.1.0/tox.ini +25 -0
@@ -0,0 +1,18 @@
1
+ [run]
2
+ branch = True
3
+ source =
4
+ pico_testing
5
+ omit =
6
+ */_version.py
7
+
8
+ [paths]
9
+ pico_testing =
10
+ src/pico_testing
11
+ .tox/*/lib/*/site-packages/pico_testing
12
+ .tox/*/site-packages/pico_testing
13
+ */site-packages/pico_testing
14
+
15
+ [report]
16
+ show_missing = True
17
+ omit =
18
+ */_version.py
@@ -0,0 +1,24 @@
1
+ name: Bug Report
2
+ description: Report a bug
3
+ labels: [bug]
4
+ body:
5
+ - type: textarea
6
+ id: description
7
+ attributes: { label: Description }
8
+ validations: { required: true }
9
+ - type: textarea
10
+ id: steps
11
+ attributes: { label: Steps to Reproduce, render: python }
12
+ validations: { required: true }
13
+ - type: textarea
14
+ id: expected
15
+ attributes: { label: Expected Behavior }
16
+ validations: { required: true }
17
+ - type: input
18
+ id: version
19
+ attributes: { label: Package Version }
20
+ validations: { required: true }
21
+ - type: input
22
+ id: python
23
+ attributes: { label: Python Version }
24
+ validations: { required: true }
@@ -0,0 +1,15 @@
1
+ name: Feature Request
2
+ description: Suggest an improvement
3
+ labels: [enhancement]
4
+ body:
5
+ - type: textarea
6
+ id: problem
7
+ attributes: { label: Problem }
8
+ validations: { required: true }
9
+ - type: textarea
10
+ id: solution
11
+ attributes: { label: Proposed Solution }
12
+ validations: { required: true }
13
+ - type: textarea
14
+ id: alternatives
15
+ attributes: { label: Alternatives Considered }
@@ -0,0 +1,13 @@
1
+ ## Summary
2
+
3
+ ## Changes
4
+
5
+ -
6
+
7
+ ## Checklist
8
+
9
+ - [ ] Tests pass (`pytest tests/ -v`)
10
+ - [ ] Linting passes (`ruff check src/ tests/`)
11
+ - [ ] CHANGELOG.md updated (if user-facing)
12
+ - [ ] No new runtime dependencies
13
+ - [ ] Single-line commit messages
@@ -0,0 +1,10 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "github-actions"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
7
+ - package-ecosystem: "pip"
8
+ directory: "/"
9
+ schedule:
10
+ interval: "weekly"
@@ -0,0 +1,69 @@
1
+ name: CI
2
+ on:
3
+ push:
4
+ branches: [main]
5
+ pull_request:
6
+ branches: [main]
7
+
8
+ jobs:
9
+ lint:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v7
13
+ - uses: actions/setup-python@v6
14
+ with:
15
+ python-version: "3.11"
16
+ - run: pip install ruff
17
+ - run: ruff check src/ tests/
18
+ - run: ruff format --check src/ tests/
19
+
20
+ tests:
21
+ runs-on: ubuntu-latest
22
+ strategy:
23
+ matrix:
24
+ python-version: ["3.11", "3.12", "3.13", "3.14"]
25
+ steps:
26
+ - uses: actions/checkout@v7
27
+ with:
28
+ fetch-depth: 0
29
+ - uses: actions/setup-python@v6
30
+ with:
31
+ python-version: ${{ matrix.python-version }}
32
+ - run: pip install tox
33
+ - name: Run tests with coverage
34
+ env:
35
+ SETUPTOOLS_SCM_PRETEND_VERSION: "0.1.0"
36
+ run: |
37
+ tox -e cov
38
+ mv .coverage .coverage.${{ matrix.python-version }}
39
+ - uses: actions/upload-artifact@v7
40
+ with:
41
+ name: coverage-${{ matrix.python-version }}
42
+ path: .coverage.${{ matrix.python-version }}
43
+ include-hidden-files: true
44
+ if-no-files-found: error
45
+
46
+ coverage:
47
+ needs: tests
48
+ runs-on: ubuntu-latest
49
+ steps:
50
+ - uses: actions/checkout@v7
51
+ - uses: actions/setup-python@v6
52
+ with:
53
+ python-version: "3.12"
54
+ - uses: actions/download-artifact@v8
55
+ with:
56
+ path: coverage-reports
57
+ - name: Combine and upload
58
+ run: |
59
+ pip install coverage
60
+ files=$(find coverage-reports -type f -name ".coverage.*")
61
+ if [ -z "$files" ]; then echo "No coverage files"; exit 1; fi
62
+ coverage combine $files
63
+ coverage xml
64
+ - uses: codecov/codecov-action@v7
65
+ continue-on-error: true
66
+ with:
67
+ token: ${{ secrets.CODECOV_TOKEN }}
68
+ files: coverage.xml
69
+ fail_ci_if_error: false
@@ -0,0 +1,21 @@
1
+ name: CodeQL
2
+ on:
3
+ push:
4
+ branches: [main]
5
+ pull_request:
6
+ branches: [main]
7
+ schedule:
8
+ - cron: "0 6 * * 1"
9
+
10
+ permissions:
11
+ security-events: write
12
+ contents: read
13
+
14
+ jobs:
15
+ analyze:
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - uses: actions/checkout@v7
19
+ - uses: github/codeql-action/init@v4
20
+ with: { languages: python }
21
+ - uses: github/codeql-action/analyze@v4
@@ -0,0 +1,48 @@
1
+ name: Docs
2
+ on:
3
+ push:
4
+ branches: [main]
5
+ paths: [docs/**, mkdocs.yml]
6
+ pull_request:
7
+ branches: [main]
8
+ paths: [docs/**, mkdocs.yml]
9
+ workflow_dispatch:
10
+
11
+ permissions:
12
+ contents: write
13
+ pages: write
14
+ id-token: write
15
+
16
+ concurrency:
17
+ group: pages
18
+ cancel-in-progress: false
19
+
20
+ jobs:
21
+ validate:
22
+ if: github.event_name == 'pull_request'
23
+ runs-on: ubuntu-latest
24
+ steps:
25
+ - uses: actions/checkout@v7
26
+ with: { fetch-depth: 0 }
27
+ - uses: actions/setup-python@v6
28
+ with: { python-version: "3.12" }
29
+ - run: pip install -r docs/requirements.txt
30
+ - run: mkdocs build --strict
31
+
32
+ deploy:
33
+ if: github.event_name != 'pull_request'
34
+ runs-on: ubuntu-latest
35
+ environment:
36
+ name: github-pages
37
+ url: ${{ steps.deployment.outputs.page_url }}
38
+ steps:
39
+ - uses: actions/checkout@v7
40
+ with: { fetch-depth: 0 }
41
+ - uses: actions/setup-python@v6
42
+ with: { python-version: "3.12" }
43
+ - run: pip install -r docs/requirements.txt
44
+ - run: mkdocs build --strict --verbose
45
+ - uses: actions/upload-pages-artifact@v5
46
+ with: { path: site }
47
+ - id: deployment
48
+ uses: actions/deploy-pages@v5
@@ -0,0 +1,24 @@
1
+ name: Publish to PyPI
2
+ on:
3
+ release:
4
+ types: [published]
5
+
6
+ permissions:
7
+ id-token: write
8
+ contents: read
9
+
10
+ jobs:
11
+ deploy:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v7
15
+ with: { fetch-depth: 0 }
16
+ - uses: actions/setup-python@v6
17
+ with: { python-version: "3.x" }
18
+ - run: pip install build
19
+ - run: python -m build
20
+ - uses: pypa/gh-action-pypi-publish@release/v1
21
+ with:
22
+ skip-existing: true
23
+ verify-metadata: true
24
+ attestations: true
@@ -0,0 +1,3 @@
1
+ sonar.python.version=3.11, 3.12, 3.13, 3.14
2
+ sonar.sources=src
3
+ sonar.tests=tests
@@ -0,0 +1,15 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.1.0] - 2026-07-10
9
+
10
+ ### Added
11
+
12
+ - Pytest plugin (entry point `pytest11`) active on install, no conftest wiring.
13
+ - Autouse isolation fixture: sets `PICO_BOOT_AUTO_PLUGINS=false` for every test.
14
+ - `@pytest.mark.pico_auto_plugins` marker to opt back into plugin auto-discovery per test.
15
+ - `make_container(*modules, config=None, boot=False)` fixture with automatic container shutdown on teardown.
@@ -0,0 +1,35 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to a positive environment:
15
+
16
+ * Using welcoming and inclusive language
17
+ * Being respectful of differing viewpoints and experiences
18
+ * Gracefully accepting constructive criticism
19
+ * Focusing on what is best for the community
20
+
21
+ Examples of unacceptable behavior:
22
+
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information without explicit permission
26
+ * Other conduct which could reasonably be considered inappropriate
27
+
28
+ ## Enforcement
29
+
30
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
31
+ reported to the project maintainer at **dperezcabrera@gmail.com**.
32
+
33
+ ## Attribution
34
+
35
+ This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1.
@@ -0,0 +1,37 @@
1
+ # Contributing to pico-testing
2
+
3
+ ## Development setup
4
+
5
+ ```bash
6
+ git clone https://github.com/dperezcabrera/pico-testing.git
7
+ cd pico-testing
8
+ python -m venv .venv && source .venv/bin/activate
9
+ pip install -e ".[dev]"
10
+ ```
11
+
12
+ ## Running tests
13
+
14
+ ```bash
15
+ pytest tests/ -v
16
+ pytest --cov=pico_testing --cov-report=term-missing tests/
17
+ tox
18
+ ```
19
+
20
+ ## Linting
21
+
22
+ ```bash
23
+ ruff check src/ tests/
24
+ ruff format src/ tests/
25
+ ```
26
+
27
+ ## Code style
28
+
29
+ - Python 3.11+
30
+ - See AGENTS.md for conventions
31
+ - Single-line commit messages
32
+
33
+ ## What NOT to do
34
+
35
+ - Don't modify `_version.py` (auto-generated)
36
+ - Don't change `version_scheme` in pyproject.toml
37
+ - Don't add runtime dependencies without discussion
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 David Pérez Cabrera
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,5 @@
1
+ include README.md LICENSE CHANGELOG.md
2
+ recursive-include src *.py py.typed
3
+ recursive-include tests *.py
4
+ exclude .gitignore Dockerfile* docker-compose*.yml Makefile
5
+ prune build dist .tox .pytest_cache __pycache__
@@ -0,0 +1,119 @@
1
+ Metadata-Version: 2.4
2
+ Name: pico-testing
3
+ Version: 0.1.0
4
+ Summary: Pytest plugin for the Pico ecosystem: isolated containers by default and a make_container fixture.
5
+ Author-email: David Perez Cabrera <dperezcabrera@gmail.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2025 David Pérez Cabrera
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/dperezcabrera/pico-testing
29
+ Project-URL: Documentation, https://dperezcabrera.github.io/pico-testing/
30
+ Project-URL: Repository, https://github.com/dperezcabrera/pico-testing
31
+ Project-URL: Changelog, https://github.com/dperezcabrera/pico-testing/blob/main/CHANGELOG.md
32
+ Project-URL: Issue Tracker, https://github.com/dperezcabrera/pico-testing/issues
33
+ Keywords: testing,pytest,fixtures,ioc,dependency injection,spring boot
34
+ Classifier: Development Status :: 4 - Beta
35
+ Classifier: Framework :: Pytest
36
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
37
+ Classifier: Programming Language :: Python :: 3
38
+ Classifier: Programming Language :: Python :: 3 :: Only
39
+ Classifier: Programming Language :: Python :: 3.11
40
+ Classifier: Programming Language :: Python :: 3.12
41
+ Classifier: Programming Language :: Python :: 3.13
42
+ Classifier: Intended Audience :: Developers
43
+ Classifier: License :: OSI Approved :: MIT License
44
+ Classifier: Operating System :: OS Independent
45
+ Classifier: Typing :: Typed
46
+ Requires-Python: >=3.11
47
+ Description-Content-Type: text/markdown
48
+ License-File: LICENSE
49
+ Requires-Dist: pico-ioc>=2.2.0
50
+ Requires-Dist: pytest>=8
51
+ Provides-Extra: dev
52
+ Requires-Dist: pytest-asyncio; extra == "dev"
53
+ Requires-Dist: pytest-cov>=5; extra == "dev"
54
+ Requires-Dist: ruff; extra == "dev"
55
+ Requires-Dist: pico-boot>=0.1.0; extra == "dev"
56
+ Dynamic: license-file
57
+
58
+ # pico-testing
59
+
60
+ [![PyPI version](https://img.shields.io/pypi/v/pico-testing.svg)](https://pypi.org/project/pico-testing/)
61
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
62
+ [![CI](https://github.com/dperezcabrera/pico-testing/actions/workflows/ci.yml/badge.svg)](https://github.com/dperezcabrera/pico-testing/actions/workflows/ci.yml)
63
+ [![codecov](https://codecov.io/gh/dperezcabrera/pico-testing/branch/main/graph/badge.svg)](https://codecov.io/gh/dperezcabrera/pico-testing)
64
+ [![Docs](https://img.shields.io/badge/docs-mkdocs-blue)](https://dperezcabrera.github.io/pico-testing/)
65
+
66
+ Pytest plugin for the [pico ecosystem](https://github.com/dperezcabrera/pico-ioc): isolated containers by default and a `make_container` fixture with automatic shutdown.
67
+
68
+ ## Why
69
+
70
+ 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:
71
+
72
+ - **Isolation by default**: `PICO_BOOT_AUTO_PLUGINS=false` is set for every test. Opt back in per-test with `@pytest.mark.pico_auto_plugins`.
73
+ - **`make_container`**: builds containers from explicit modules and config, and shuts them all down on teardown.
74
+
75
+ ## Installation
76
+
77
+ ```bash
78
+ pip install pico-testing
79
+ ```
80
+
81
+ No conftest wiring — installing it activates the plugin.
82
+
83
+ ## Quick start
84
+
85
+ ```python
86
+ import sys
87
+
88
+ def test_my_service(make_container):
89
+ container = make_container(
90
+ "my_package",
91
+ config={"my_prefix": {"key": "value"}},
92
+ )
93
+ service = container.get(MyService)
94
+ assert service.do_something() == "expected"
95
+ ```
96
+
97
+ `make_container(*modules, config=None, boot=False)`:
98
+
99
+ - `modules`: module objects or import strings, passed to `init(modules=[...])`.
100
+ - `config`: a plain dict (wrapped in `configuration(DictSource(...))`) or a ready `configuration(...)` object.
101
+ - `boot=True`: use `pico_boot.init` instead of `pico_ioc.init` (plugin auto-discovery still off unless the test is marked).
102
+
103
+ Re-enable plugin auto-discovery for a single test:
104
+
105
+ ```python
106
+ import pytest
107
+
108
+ @pytest.mark.pico_auto_plugins
109
+ def test_full_boot(make_container):
110
+ container = make_container(boot=True)
111
+ ```
112
+
113
+ ## Documentation
114
+
115
+ Full documentation: https://dperezcabrera.github.io/pico-testing/
116
+
117
+ ## License
118
+
119
+ MIT
@@ -0,0 +1,62 @@
1
+ # pico-testing
2
+
3
+ [![PyPI version](https://img.shields.io/pypi/v/pico-testing.svg)](https://pypi.org/project/pico-testing/)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![CI](https://github.com/dperezcabrera/pico-testing/actions/workflows/ci.yml/badge.svg)](https://github.com/dperezcabrera/pico-testing/actions/workflows/ci.yml)
6
+ [![codecov](https://codecov.io/gh/dperezcabrera/pico-testing/branch/main/graph/badge.svg)](https://codecov.io/gh/dperezcabrera/pico-testing)
7
+ [![Docs](https://img.shields.io/badge/docs-mkdocs-blue)](https://dperezcabrera.github.io/pico-testing/)
8
+
9
+ Pytest plugin for the [pico ecosystem](https://github.com/dperezcabrera/pico-ioc): isolated containers by default and a `make_container` fixture with automatic shutdown.
10
+
11
+ ## Why
12
+
13
+ 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:
14
+
15
+ - **Isolation by default**: `PICO_BOOT_AUTO_PLUGINS=false` is set for every test. Opt back in per-test with `@pytest.mark.pico_auto_plugins`.
16
+ - **`make_container`**: builds containers from explicit modules and config, and shuts them all down on teardown.
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ pip install pico-testing
22
+ ```
23
+
24
+ No conftest wiring — installing it activates the plugin.
25
+
26
+ ## Quick start
27
+
28
+ ```python
29
+ import sys
30
+
31
+ def test_my_service(make_container):
32
+ container = make_container(
33
+ "my_package",
34
+ config={"my_prefix": {"key": "value"}},
35
+ )
36
+ service = container.get(MyService)
37
+ assert service.do_something() == "expected"
38
+ ```
39
+
40
+ `make_container(*modules, config=None, boot=False)`:
41
+
42
+ - `modules`: module objects or import strings, passed to `init(modules=[...])`.
43
+ - `config`: a plain dict (wrapped in `configuration(DictSource(...))`) or a ready `configuration(...)` object.
44
+ - `boot=True`: use `pico_boot.init` instead of `pico_ioc.init` (plugin auto-discovery still off unless the test is marked).
45
+
46
+ Re-enable plugin auto-discovery for a single test:
47
+
48
+ ```python
49
+ import pytest
50
+
51
+ @pytest.mark.pico_auto_plugins
52
+ def test_full_boot(make_container):
53
+ container = make_container(boot=True)
54
+ ```
55
+
56
+ ## Documentation
57
+
58
+ Full documentation: https://dperezcabrera.github.io/pico-testing/
59
+
60
+ ## License
61
+
62
+ MIT
@@ -0,0 +1,11 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ | Version | Supported |
6
+ |---------|-----------|
7
+ | 0.1.x | Yes |
8
+
9
+ ## Reporting a Vulnerability
10
+
11
+ Email dperezcabrera@gmail.com with details. You will receive acknowledgment within 48 hours.
@@ -0,0 +1,15 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.1.0] - 2026-07-10
9
+
10
+ ### Added
11
+
12
+ - Pytest plugin (entry point `pytest11`) active on install, no conftest wiring.
13
+ - Autouse isolation fixture: sets `PICO_BOOT_AUTO_PLUGINS=false` for every test.
14
+ - `@pytest.mark.pico_auto_plugins` marker to opt back into plugin auto-discovery per test.
15
+ - `make_container(*modules, config=None, boot=False)` fixture with automatic container shutdown on teardown.
@@ -0,0 +1,17 @@
1
+ # FAQ
2
+
3
+ ## Why does my suite behave differently after installing pico-testing?
4
+
5
+ Because that is the point: the plugin sets `PICO_BOOT_AUTO_PLUGINS=false` for every test. If a test relied on auto-discovered plugins, mark it with `@pytest.mark.pico_auto_plugins` — or better, pass its modules explicitly to `make_container`.
6
+
7
+ ## Do I still need my own conftest fixtures?
8
+
9
+ If your conftest only contained the isolation fixture and a container factory, you can delete both. Project-specific fixtures stay where they are; a local fixture named `make_container` overrides the plugin's.
10
+
11
+ ## Does it work without pico-boot?
12
+
13
+ Yes. The default path uses `pico_ioc.init`. `pico_boot` is imported only when you call `make_container(boot=True)`.
14
+
15
+ ## Why is shutdown newest-first?
16
+
17
+ Containers created later may depend on state from earlier ones; tearing down in reverse creation order mirrors how nested resources unwind.
@@ -0,0 +1,52 @@
1
+ # Getting Started
2
+
3
+ ## Prerequisites
4
+
5
+ - Python >= 3.11
6
+ - pytest >= 8
7
+ - pico-ioc >= 2.2.0 (pico-boot only if you use `boot=True`)
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ pip install pico-testing
13
+ ```
14
+
15
+ ## Key concepts
16
+
17
+ | Piece | What it does |
18
+ |---|---|
19
+ | Isolation fixture (autouse) | Sets `PICO_BOOT_AUTO_PLUGINS=false` for every test so `pico_boot.init()` loads only explicit modules |
20
+ | `@pytest.mark.pico_auto_plugins` | Opts a single test back into plugin auto-discovery |
21
+ | `make_container` | Builds containers from explicit modules and config; shuts them all down on teardown |
22
+
23
+ ## make_container
24
+
25
+ ```python
26
+ def test_service(make_container):
27
+ container = make_container(
28
+ "my_package", # module objects or import strings
29
+ config={"my_prefix": {"key": "value"}}, # dict or configuration(...) object
30
+ )
31
+ service = container.get(MyService)
32
+ ```
33
+
34
+ Signature: `make_container(*modules, config=None, boot=False)`
35
+
36
+ - `modules` — passed to `init(modules=[...])`. Explicit is the point: list what the test needs.
37
+ - `config` — a plain dict is wrapped in `configuration(DictSource(...))`; a prepared `configuration(...)` passes through.
38
+ - `boot=True` — uses `pico_boot.init` instead of `pico_ioc.init`. Auto-discovery stays off unless the test carries the marker.
39
+
40
+ Every container created through the fixture is shut down on teardown, newest first.
41
+
42
+ ## Re-enabling auto-discovery
43
+
44
+ ```python
45
+ import pytest
46
+
47
+ @pytest.mark.pico_auto_plugins
48
+ def test_full_boot(make_container):
49
+ container = make_container(boot=True)
50
+ ```
51
+
52
+ Use this only for tests that genuinely verify entry-point discovery — everything else should list its modules.
@@ -0,0 +1,7 @@
1
+ import logging
2
+
3
+ # Suppress griffe warnings about missing type annotations in strict mode.
4
+ # These are cosmetic and don't affect documentation generation.
5
+ # griffe's logger is patched by mkdocstrings to use mkdocs.plugins.* namespace.
6
+ for name in ("griffe", "mkdocs.plugins.griffe", "_griffe"):
7
+ logging.getLogger(name).setLevel(logging.ERROR)