Metadata-Version: 2.1
Name: pytest_case
Version: 0.2.2
Summary: A clean, modern, wrapper for pytest.mark.parametrize
Home-page: https://github.com/eitanwass/pytest-case
License: Apache-2.0
Keywords: pytest,parametrize,case,test
Author: Ethan Wass
Author-email: eitanwass@gmail.com
Requires-Python: >=3.8,<4.0
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
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 :: 3.13
Requires-Dist: pytest (>=8.3.3,<9.0.0)
Project-URL: Repository, https://github.com/eitanwass/pytest-case
Description-Content-Type: text/markdown

# pytest-case

![workflow success](https://github.com/eitanwass/pytest-case/actions/workflows/pytest-case-ci.yml/badge.svg) [![codecov](https://codecov.io/github/eitanwass/pytest-case/graph/badge.svg?token=07NGAILDL2)](https://codecov.io/github/eitanwass/pytest-case) 

![PyPI - Downloads](https://img.shields.io/pypi/dm/pytest-case) [![PyPI - Version](https://img.shields.io/pypi/v/pytest-case)](https://pypi.org/project/pytest-case)


# Usage examples:

```python
import pytest
from typing import Tuple, Generator
from pytest_case import case


def add_test_cases() -> Generator[Tuple[int, int, int]]:
    yield (
        n
        for n in [
            (3, 3, 6),
            (3, 4, 7),
            (-1, 6, 5),
        ]
    )


@case("regular args", 4, 2, 2)
@case(
    "params as kwargs",
    a=2,
    b=2,
    expected=1,
)
@case('with expected fail', 1, 0, mark=pytest.mark.xfail)
@case(add_test_cases())
def test__divide(a, b, expected) -> None:
    assert expected == a / b
```

# Features

## Generator Case
```python
from itertools import product
from pytest_case import case

@case(product(
    ("Chrome", "Firefox", "Safari"), 
    ("Windows", "macOS", "Linux")
))
def test__browser_os_compatibility(browser: str, operating_system: str) -> None:
    # Will generate cases:
    # ("Chrome", "Windows"), ("Chrome", "macOS"), ("Chrome", "Linux"), ("Firefox", "Windows"), ...
    pass
```

# Project Roadmap:
These are the the predicted checkpoints for this project:

- [x] **Test Marks**
    Marks that are currently supported by pytest, such as: xfail, skip, ...
- [x] **Tests Cases Generators**
    Provide a generator function to the `case` to automatically generate cases.
- [ ] **Tests Samples Generation**
    Generate parameters to catch edge-cases, based on restrictions or datasets.

