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
Release files for pytest-maybe-context 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pytest_maybe_context-0.1.tar.gz | 1.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_maybe_context-0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 4.2 kB
Release files / pytest_maybe_context-0.1.tar.gz
| Download URL | pytest_maybe_context-0.1.tar.gz |
|---|---|
| Size | 1.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aaaf8f17f14aa67e5ceec023241ae7bd780773cac23c9ef24db967ade141d91b
|
|
BLAKE2b-256 checksum How to use checksums |
75e995625716411309e905fc055c950bc71509b9d2effa159baf76f69cd71963
|
| 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.1-py3-none-any.whl
| Download URL | pytest_maybe_context-0.1-py3-none-any.whl |
|---|---|
| Size | 2.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9c4e11638fab57a4902c2c61efd602ba2683b8a9e54d98457d9ac7c2725a5479
|
|
BLAKE2b-256 checksum How to use checksums |
e8e82f8be5caa709ee3f2901aa19baae4d51e6b10fd6b5541a2698c28f922f9d
|
| 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
|