A clean, modern, wrapper for pytest.mark.parametrize
Project description
pytest-case
Usage examples:
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
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:
- Test Marks Marks that are currently supported by pytest, such as: xfail, skip, ...
- 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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pytest_case-0.1.1.tar.gz
(8.2 kB
view details)
Built Distribution
File details
Details for the file pytest_case-0.1.1.tar.gz
.
File metadata
- Download URL: pytest_case-0.1.1.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e346aa850f7f21f501214571f4cbecad1625fa1223750cbaff367bc387dae2f3 |
|
MD5 | 501830cad13de3f354cf8d5938c0abb9 |
|
BLAKE2b-256 | c77f2782e1be79b76627d1a3a5b1dbc396bf80283b1bcbd90b0a004b1403ead3 |
Provenance
The following attestation bundles were made for pytest_case-0.1.1.tar.gz
:
Publisher:
release.yml
on eitanwass/pytest-case
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
pytest_case-0.1.1.tar.gz
- Subject digest:
e346aa850f7f21f501214571f4cbecad1625fa1223750cbaff367bc387dae2f3
- Sigstore transparency entry: 150576799
- Sigstore integration time:
- Predicate type:
File details
Details for the file pytest_case-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: pytest_case-0.1.1-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51956d63699d150adc74535113f3c381be0123bc947573a5ae60ce9faf1f8e9c |
|
MD5 | 7e45a8d89be4e2df406d02307878b5c7 |
|
BLAKE2b-256 | f91d39e1f3c025435a6ebed9e29608400c29544a9e9c070432506390d3f07e86 |
Provenance
The following attestation bundles were made for pytest_case-0.1.1-py3-none-any.whl
:
Publisher:
release.yml
on eitanwass/pytest-case
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
pytest_case-0.1.1-py3-none-any.whl
- Subject digest:
51956d63699d150adc74535113f3c381be0123bc947573a5ae60ce9faf1f8e9c
- Sigstore transparency entry: 150576803
- Sigstore integration time:
- Predicate type: