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.2.tar.gz
(8.2 kB
view details)
Built Distribution
File details
Details for the file pytest_case-0.1.2.tar.gz
.
File metadata
- Download URL: pytest_case-0.1.2.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 | aaf72bb1666f59f3bd9c18c6c200006765f98e27cce20f013663a76459ef17fc |
|
MD5 | 4ad594df292954bb20d430e73dc73ef0 |
|
BLAKE2b-256 | 1dbc5342369af270965999b41f8357ff6b539a2e4a79dec4b847d3d2f00c62b2 |
Provenance
The following attestation bundles were made for pytest_case-0.1.2.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.2.tar.gz
- Subject digest:
aaf72bb1666f59f3bd9c18c6c200006765f98e27cce20f013663a76459ef17fc
- Sigstore transparency entry: 150828998
- Sigstore integration time:
- Predicate type:
File details
Details for the file pytest_case-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: pytest_case-0.1.2-py3-none-any.whl
- Upload date:
- Size: 10.0 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 | c6462f1e7e1bdcac1884855340ede1aa621a8f0961fab4ec75d64cb34eb15646 |
|
MD5 | 178b90a6500826ee92f3ec3705e921fd |
|
BLAKE2b-256 | 6b76690b0b2d6a362143c1999c8bf22d04fff19b7cec2c3d571783b24331f506 |
Provenance
The following attestation bundles were made for pytest_case-0.1.2-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.2-py3-none-any.whl
- Subject digest:
c6462f1e7e1bdcac1884855340ede1aa621a8f0961fab4ec75d64cb34eb15646
- Sigstore transparency entry: 150828999
- Sigstore integration time:
- Predicate type: