Auto‑Fixture Plugin
Generate pytest fixtures automatically from params.yaml files.
- Each test directory may contain a
params.yaml. - Every top‑level key becomes a fixture.
- Fixtures only apply to tests in the same directory and its subdirectories.
Auto Fixture Definitions
Example tests/params.yaml
# Values
timeout: 30
env: "staging"
# Lists
ids: [1, 2, 3]
priority: ["medium", "low"]
scores: [22, 7, 64]
tags: ["a", "b"]
# Dictionaries
numbers:
type: ["int", "float"]
example: ["123", "4.56"]
# Mode: product (cartesian product)
pets:
_mode: product
animal: ["cat", "dog"]
name: ["alice", "bob"]
# Mode: zip (pairs items position-wise)
login:
_mode: zip
username: ["alice", "bob"]
password: ["123", "456"]
Example tests/other/params.yaml
# Merge: append, true
ids:
_merge: append
values: [4, 5, 6]
# Merge: prepend
priority:
_merge: prepend
values: ["critical", "high"]
# Merge: sort, sorted
scores:
_merge: sort
values: [40, 26, 83]
# Merge: unique
tags:
_merge: unique
values: ["b", "c"]
Resulting Fixtures
Fixtures available in tests/
timeout = 30
env = "staging"
ids = [1, 2, 3]
priority = ["medium", "low"]
scores = [22, 7, 64]
tags = ["a", "b"]
numbers = {
"type": ["int", "float"],
"example": ["123", "4.56"],
}
pets = [
{"animal": "cat", "name": "alice"},
{"animal": "cat", "name": "bob" },
{"animal": "dog", "name": "alice"},
{"animal": "dog", "name": "bob" },
]
login = [
{"username": "alice", "password": "123"},
{"username": "bob", "password": "456"},
]
Fixtures available in tests/other/
timeout = 30
env = "staging"
ids = [1, 2, 3, 4, 5, 6]
priority = ["critical", "high", "medium", "low"]
scores = [7, 22, 26, 40, 64, 83]
tags = ["a", "b", "c"]
numbers = {
"type": ["int", "float"],
"example": ["123", "4.56"],
}
pets = [
{"animal": "cat", "name": "alice"},
{"animal": "cat", "name": "bob" },
{"animal": "dog", "name": "alice"},
{"animal": "dog", "name": "bob" },
]
login = [
{"username": "alice", "password": "123"},
{"username": "bob", "password": "456"},
]
Directory Scoping
Fixtures defined in tests/foo_tests/params.yaml are available to foo_tests/ and any subfolders.
Example Test Directory Structure
tests/
test_foo.py
other/
test_bar.py
params.yaml
params.yaml
Fixtures in tests/params.yaml apply to tests/ and tests/other/.
Fixtures in tests/other/params.yaml override or merge with tests/params.yaml and apply only to tests/other/.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Release files for pytest-auto-param-fixtures 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pytest_auto_param_fixtures-0.1.0.tar.gz | 4.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_auto_param_fixtures-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.9 kB
Release files / pytest_auto_param_fixtures-0.1.0.tar.gz
| Download URL | pytest_auto_param_fixtures-0.1.0.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a7a884c9a64893c769d5c40a0245b06205f29b2c75921643f6cce56da91120cd
|
|
BLAKE2b-256 checksum How to use checksums |
6614eebafb62528937addea3b71f6764501034aa5de44fe4910b417908256074
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / pytest_auto_param_fixtures-0.1.0-py3-none-any.whl
| Download URL | pytest_auto_param_fixtures-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
86fb609cfc03397f32aaa19880a3cc9536abe8d81ad8275988820acd9fddb15c
|
|
BLAKE2b-256 checksum How to use checksums |
3b97b72a88968edc54f455f30ba861357e8c51eac1efd408c7937558d60c4438
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|