Skip to main content

pytest-maybe-context

Makes it a bit easier to write warning and exception checks along other cases.

from pytest import mark, raises, warns
from pytest_maybe_context import maybe_context, not_context

@mark.parametrize(('buffering', 'expected'), (
    (0, b'contents'),
    (1, warns(RuntimeWarning)),
    (.1, raises(TypeError))
))
def test_example(buffering, expected):
    with maybe_context(expected):
        file = open('file', 'rb', buffering)
    if not_context(expected):
        assert file.read() == expected

Installation

poetry add pytest-maybe-context --group dev

Metadata

Release files for pytest-maybe-context 0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-maybe-context 0
File Size Uploaded Provenance
pytest_maybe_context-0.tar.gz 1.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-maybe-context 0
File Interpreter ABI Platform
pytest_maybe_context-0-py3-none-any.whl Python 3 none any Details

Total release size: 4.1 kB

Release files / pytest_maybe_context-0.tar.gz

Download URL pytest_maybe_context-0.tar.gz
Size 1.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c5781e2166760380d4d3e28317b5b089cb2e27b6c8210d5d1ad6db28812f62dd
BLAKE2b-256 checksum
How to use checksums
200317764a88b2231a3f1278fdf2ce03309dde0fdaf8b543b6e447ed829b8d3c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.10.6 Linux/5.19.0-38-generic

Release files / pytest_maybe_context-0-py3-none-any.whl

Download URL pytest_maybe_context-0-py3-none-any.whl
Size 2.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
237098a5a71ec7387ffadcd8f4c8c87875be05a02dbd8e424913ad66fce4f86b
BLAKE2b-256 checksum
How to use checksums
8e374b06329b1b2d3b38dfc262875f716ae2b08b241094d973c20e30e71f7166
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.10.6 Linux/5.19.0-38-generic

Security for pytest-maybe-context 0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page