Skip to main content

No project description provided

Project description

pytest-case

workflow success codecov

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.0.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

pytest_case-0.1.0-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file pytest_case-0.1.0.tar.gz.

File metadata

  • Download URL: pytest_case-0.1.0.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pytest_case-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8c9ff6641321ac15b20cae6806cece522c566daa0fb5d25bf1ae9c98fa9b8d30
MD5 089d0aeab781df6de59ad70c7cb4e952
BLAKE2b-256 4046bd6c259f94dbcfffe809ef7d6f78ec5e6a467a4f3585416b67d3166bc032

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_case-0.1.0.tar.gz:

Publisher: release.yml on eitanwass/pytest-case

Attestations:

File details

Details for the file pytest_case-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pytest_case-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pytest_case-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bfddded40342a61678eb57d361b71eb921edb132a032a57417a3becf264c4ac6
MD5 67168f91d5f9d023a2abbe23b5db005b
BLAKE2b-256 b7bfa71c90e2f25a30a8142c81b2329626995b2299805693c1180a21e16e194c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_case-0.1.0-py3-none-any.whl:

Publisher: release.yml on eitanwass/pytest-case

Attestations:

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page