A Python package for managing pytest plugins.
Project description
pytest-dynamic-parameterize
A powerful pytest plugin for Python projects, enabling dynamic test parameterization using functions.
Easily generate test parameters at runtime from any function—supporting advanced, data-driven, or config-based testing workflows.
🚀 Features
- ✅ Dynamic Parameterization: Generate test parameters dynamically by referencing a function.
- Use the
@pytest.mark.parametrize_func("function_name")marker on your test. - Supports both local and fully-qualified function names (e.g.,
my_funcormy_module.my_func). - Enables:
- Data-driven tests from config files, databases, or APIs
- Centralized test data logic
- Cleaner, more maintainable test code
- Use the
📦 Installation
pip install pytest-dynamic-parameterize
🔧 Usage
- Define a parameter function (must accept a
configargument and return a list of tuples or values):
# parameterize_functions.dynamic_parameters.my_params.py
def my_params(config):
# Example: generate parameters dynamically
return [
(1, 2, 3),
(4, 5, 9),
]
- Mark your test with
@pytest.mark.parametrize_func:
import pytest
from parameterize_functions.dynamic_parameters import my_params
@pytest.mark.parametrize_func("my_params")
def test_add(a, b, expected):
assert a + b == expected
-
You can also use a fully-qualified function path:
@pytest.mark.parametrize_func("parameterize_functions.dynamic_parameters.my_params") def test_add(a, b, expected): ...
-
The function can be imported or defined in the same module.
-
The function should return a list of argument tuples matching the test signature.
🤝 Contributing
If you have improvements, ideas, or bugfixes:
- Fork the repo
- Create a new branch
- Submit a pull request
I welcome additions that promote clean, productive, and maintainable development.
🙏 Thanks
Thanks for exploring this repository!
Happy testing!
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 pytest_dynamic_parameterize-0.1.0.tar.gz.
File metadata
- Download URL: pytest_dynamic_parameterize-0.1.0.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
989f0c577337a86bd66444d3e7f1c3b98eb3daf5350afdda2789fb9ddde20b43
|
|
| MD5 |
78708c49cb1d3d9e52eb7fe0ed2403fe
|
|
| BLAKE2b-256 |
f5c8059ca381c7b2334c5d7f20fce418d0818bbb4809646ef7d38c61ccf3f8de
|
File details
Details for the file pytest_dynamic_parameterize-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pytest_dynamic_parameterize-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0fa294bca25242986ebfc0a45d09ce2b1f5f028f6b1aa682454b84c098816515
|
|
| MD5 |
73c9127331aaaef023d3edaafa6cb238
|
|
| BLAKE2b-256 |
c3e5e68b6676d204f86f4e3f80d7566243594d43356e26ddc05314df71d2eea6
|