Skip to main content

Simulating poor network connections.

Project description

Poorconn simulates unstable network conditions. It is suitable for testing purposes.

Quickstart

Install this package via

$ pip install 'poorconn[full]'  # or "pip install poorconn" if you don't need pytest support

If you use pytest:

pytest_plugins = ('poorconn',)

from pathlib import Path
import time
import requests
import pytest

@pytest.mark.poorconn_http_server_config(t=2, length=1024)
def test_slow_http_server(poorconn_http_server, tmp_path):
    "Test GETing from a slow local http server that delays 2 seconds to send every 1024 bytes."
    (tmp_path / 'index.txt').write_bytes(b'h' * 1024)
    starting_time = time.time()
    content = requests.get(f'{poorconn_http_server.url}/index.txt').content
    ending_time = time.time()
    assert ending_time - starting_time > 2

Bug Reports and Feature Requests

Please open a ticket on the GitLab Issue Tracker.

Contributing

Contributions are welcome! To get started, check out CONTRIBUTING.rst.

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

poorconn-0.1b0.tar.gz (34.1 kB view details)

Uploaded Source

Built Distribution

poorconn-0.1b0-py3-none-any.whl (43.0 kB view details)

Uploaded Python 3

File details

Details for the file poorconn-0.1b0.tar.gz.

File metadata

  • Download URL: poorconn-0.1b0.tar.gz
  • Upload date:
  • Size: 34.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.25.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.3

File hashes

Hashes for poorconn-0.1b0.tar.gz
Algorithm Hash digest
SHA256 d0293ab78a6cbcd00cd05450598ea2d80a63ed9661d1b39a0c3f7a701bc73777
MD5 e0318607697cbfca37b075f21ccc8a3f
BLAKE2b-256 7b521c060fee90f47428dc8d077699ebdbf8816a6b5eb2d8f00a253c90536df6

See more details on using hashes here.

File details

Details for the file poorconn-0.1b0-py3-none-any.whl.

File metadata

  • Download URL: poorconn-0.1b0-py3-none-any.whl
  • Upload date:
  • Size: 43.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.25.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.3

File hashes

Hashes for poorconn-0.1b0-py3-none-any.whl
Algorithm Hash digest
SHA256 f7cd58078548b7f63d60e42ac84de8a4e9a883ea57cc370faae0a5ad5f6ee33f
MD5 3a423e85fd6bc21866d0a538884d2ac8
BLAKE2b-256 3c39bfe0572cca1c85962896fbc4388f86cda6864f39caaec7cb3ea054ff348e

See more details on using hashes here.

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