Skip to main content

Disable network requests during a test run.

Project description

pytest-blockage

Disable SMTP and HTTP requests during a test run.

Based mainly on https://github.com/andymckay/nose-blockage; source is available at https://github.com/rob-b/pytest-blockage

Installation

The plugin can be installed via pypi:

$ pip install pytest-blockage

Usage

To activate the plugin the --blockage parameter should be passed. e.g.:

$ py.test package --blockage

You can whitelist specific hosts:

$ py.test package --blockage --blockage-http-whitelist=some_site --blockage-smtp-whitelist=fake_smtp

Configuration

All settings can be stored in your pytest file, with the same variable names as the argument names mentioned under usage:

blockage=true
blockage-http-whitelist=some_site
blockage-smtp-whitelist=fake_smtp

Changelog

0.2.1 (2018-12-01)

  • HTTP whitelisting

  • SMTP whitelisting

0.2.0 (2015-06-22)

  • Added python 3 support

0.1 (2013-05-11)

  • Initial Release

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

pytest-blockage-0.2.1.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

pytest_blockage-0.2.1-py2.py3-none-any.whl (3.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pytest-blockage-0.2.1.tar.gz.

File metadata

  • Download URL: pytest-blockage-0.2.1.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.15rc1

File hashes

Hashes for pytest-blockage-0.2.1.tar.gz
Algorithm Hash digest
SHA256 576244be209c7c2820fc55fd3aaaa68f5e8e78c76f513e797d722abfa470371f
MD5 636c61f00c4efc5595445698b3214e37
BLAKE2b-256 1117e0364e71991a8cccb6cc3574f463788076d27cac3331085248d1f63d494d

See more details on using hashes here.

File details

Details for the file pytest_blockage-0.2.1-py2.py3-none-any.whl.

File metadata

  • Download URL: pytest_blockage-0.2.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.15rc1

File hashes

Hashes for pytest_blockage-0.2.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6ff24d71f5e76d0ad75b1395626d9cf9122e799ebb386170e31097b6d236b71f
MD5 f43e7224d9fac41db9bf675a1c227f83
BLAKE2b-256 6ae1384fa19674ebfd85b1bab1f2c8aba06652c3cef62ee1f9d1976dcf17c1d2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page