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.3 (2021-12-21)

  • FIX: sdist package was broken

0.2.2 (2019-02-13)

  • FIX: SMTP whitelisting works with python3 as well

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.3.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: pytest-blockage-0.2.3.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for pytest-blockage-0.2.3.tar.gz
Algorithm Hash digest
SHA256 479c2cbf3b224b15fde67c29b250dd1fe983aa0d58b55f2483615130e39bf9a4
MD5 26ecf0bd94f65711f1a1483567acd99b
BLAKE2b-256 ccdf514c7c700250cc56dce918f19c05192ba39083520acdddb936e2f68bcf17

See more details on using hashes here.

File details

Details for the file pytest_blockage-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: pytest_blockage-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for pytest_blockage-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 dcdf07023c9fb4e3f66c26214a17b5b53e5d892f64316d3bdbf4702a2e9f350c
MD5 bbbdd45d91ec10701a4349481c6dd5a2
BLAKE2b-256 1874278539711e5358c6134fefc0f9b4515a5d2a7ab1826fa9c73b9de88f6169

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