Skip to main content

pytest-netscenario

A pytest plugin for netscenario: run a network scenario as a test and assert on loss, delay and throughput, also with a confidence interval over repeated runs.

pip install pytest-netscenario     # also installs netscenario, in exactly the same version
# test_video_call.py, next to video-call.yaml
def test_the_video_arrives_in_time(netscenario):
    video = netscenario.run("video-call.yaml")["video"]
    assert video.loss_ratio < 0.05
    assert video.delay.p99 < 0.100  # seconds

With repetitions the scenario runs several times with derived seeds, and the assertion is on an interval:

@pytest.mark.netscenario("video-call.yaml", repetitions=10)
def test_the_loss_is_low(netscenario_runs):
    assert netscenario_runs.metric("video.loss_ratio").ci95_high < 0.05

The plugin gives the fixture netscenario (a runner that finds the scenario file next to the test), the marker netscenario(...) with the fixture netscenario_result, a guard that skips (or, on a CI, fails) when the machine cannot create network namespaces, and a section in the report with the numbers of each run. It needs Linux with the tools and rights that netscenario doctor checks (permissions).

A complete example with its scenario file and its output: examples/python-test. Documentation: docs/PYTEST.md. The status is pre-alpha.

Licensed under either of Apache License 2.0 or MIT, at your option.

Metadata

Release files for pytest-netscenario 0.3.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-netscenario 0.3.0
File Size Uploaded Provenance Actions
pytest_netscenario-0.3.0.tar.gz 19.8 kB With provenance Details for pytest_netscenario-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pytest-netscenario 0.3.0
File Interpreter ABI Platform Actions
pytest_netscenario-0.3.0-py3-none-any.whl Python 3 none any Details for pytest_netscenario-0.3.0-py3-none-any.whl

Total release size: 36.3 kB

Release files / pytest_netscenario-0.3.0.tar.gz

Download URL pytest_netscenario-0.3.0.tar.gz
Size 19.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9608e397ab858cb97f0abaaa5ea3cc81633a206d397b664464b52308dd12a071
BLAKE2b-256 checksum
How to use checksums
8819bf2d1f4eda4e0edeaaa1e43b3add48401326a2fc9d2703957e9cbf01f617
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / pytest_netscenario-0.3.0-py3-none-any.whl

Download URL pytest_netscenario-0.3.0-py3-none-any.whl
Size 16.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cff3a34283260944e0ddb01e82caa39c18aeaf580c751379728fee3320b54a52
BLAKE2b-256 checksum
How to use checksums
818b749bdd4cfa64aebc03cdeb2390a3224128f83794ddd8536ce82eebc5a9a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Security for pytest-netscenario 0.3.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pytest_netscenario-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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