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.2.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.2.0
File Size Uploaded Provenance Actions
pytest_netscenario-0.2.0.tar.gz 17.2 kB With provenance Details for pytest_netscenario-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 32.4 kB

Release files / pytest_netscenario-0.2.0.tar.gz

Download URL pytest_netscenario-0.2.0.tar.gz
Size 17.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5cc47014381d8e91da3d34a26f824cb9d95449df39cfe8cf3e8d163b7e3e457a
BLAKE2b-256 checksum
How to use checksums
536f47f88a5ce46a95d5ad015afcff3757c031702413b0de51dcd4422db90adb
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 3, 2026.

Transparency log

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

Download URL pytest_netscenario-0.2.0-py3-none-any.whl
Size 15.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bee344bc69a875c7bb4517ba90700793ff4c057c20c05bc7ec3dc077365694d0
BLAKE2b-256 checksum
How to use checksums
a81bf18286b35935d59c929fb6f74a9dd1fede52bd1c77108b824fea60dff581
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 3, 2026.

Transparency log

Security for pytest-netscenario 0.2.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.2.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 3, 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