Metadata-Version: 2.1
Name: pytest-parametrize
Version: 1.1.1
Summary: pytest decorator for parametrizing test cases in a dict-way
Home-page: https://github.com/MarcinSkrobczynski/pytest-parametrize
License: MIT
Keywords: pytest,parametrize,testing
Author: Marcin Skrobczyński
Author-email: marcin@skrobczynski.pl
Requires-Python: >=3.9,<4.0
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Framework :: Pytest
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Testing
Requires-Dist: pytest (>=8.3.0,<9.0.0)
Requires-Dist: setuptools (>=75.0.0,<76.0.0) ; python_version < "3.10"
Description-Content-Type: text/markdown

[![image](https://img.shields.io/pypi/v/pytest-parametrize.svg)](https://pypi.org/project/pytest-parametrize/)
[![image](https://img.shields.io/pypi/pyversions/pytest-parametrize.svg)](https://pypi.org/project/pytest-parametrize/)
[![image](https://img.shields.io/pypi/status/pytest-parametrize.svg)](https://pypi.org/project/pytest-parametrize/)

[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/MarcinSkrobczynski/pytest-parametrize/build_and_deploy.yml?label=build&logo=github&logoColor=white&style=flat-square)](https://github.com/MarcinSkrobczynski/pytest-parametrize/actions/workflows/build_and_deploy.yml)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?style=flat-square&logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
[![image](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)

# pytest-parametrize

[pytest](https://pytest.org/) decorator for parametrizing test cases in a dict-way.
It is an alternative for the [pytest.mark.parametrize](https://docs.pytest.org/en/latest/how-to/parametrize.html).

## Usage
Decorate test function with test cases defined as a dictionary.

### Example:
```python
import pytest
from pytest_parametrize import parametrize

@parametrize(
    {
        "test-case-1": {"a": 1, "b": 2, "c": 3},
        "test-case-2": {"a": 2, "b": 3, "c": 5},
        "test-case-3": [
            {"a": 3, "b": 5, "c": 8},
            {"a": 5, "b": 8, "c": 13},
            {"a": 8, "b": 13, "c": 21},
            {"a": 0, "b": 0, "c": 1, "marks": pytest.mark.xfail},
        ],
    },
)
def test_something(a, b, c):
    assert a + b == c
```

### Description
Decorator takes dict, which:
- keys define names of the test cases, and
- values define named arguments in dict manner (or list of such dicts), which are passed to the decorated test function.

## Installation

### pip
```shell
pip install pytest-parametrize
```

### poetry
```shell
poetry add pytest-parametrize
```

# Collaboration

## Test & coverage
```shell
pytest -vvv tests --cov=pytest_parametrize
```

