Skip to main content

Disable network requests during a test run.

Project description


Disable SMTP and HTTP requests during a test run.

Based mainly on; source is available at


The plugin can be installed via pypi:

$ pip install pytest-blockage


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


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



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.

Files for pytest-blockage, version 0.2.2
Filename, size File type Python version Upload date Hashes
Filename, size pytest_blockage-0.2.2-py2.py3-none-any.whl (3.7 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size pytest-blockage-0.2.2.tar.gz (2.5 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page