Skip to main content

Pytest plugin for intercepting outgoing connection requests during pytest run.

Project description

Build Coverage

This package provides a plugin for pytest framework to intercept outgoing connection requests and dumps them to a file.

Installation

The pytest-intercept-remote plugin can be installed by using:

$ git clone https://github.com/devanshshukla99/pytest-intercept-remote
$ cd pytest-intercept-remote
$ pip install .

The plugin will register automatically with pytest framework and will be ready to use.

Config

The default dump file can be configured by specifing intercept_dump_file in the ini file or by overriding it by -o intercept_dump_file.

$ pytest --intercept-remote -o intercept_dump_file=urls.json

Usage

This plugin can be used by adding --remote-data=any --intercept-remote options;

NOTE: The plugin only works over functions marked with remote_data marker, see remotedata for more info.

$ pytest --remote-data=any --intercept-remote

The tests trying to connect to internet will xfail.

Testing

Use tox to make sure the plugin is working:

$ git clone https://github.com/devanshshukla99/pytest-intercept-remote
$ cd pytest-intercept-remote
$ tox -e py38

See tox for more info.

Licence

This plugin is licenced under a 3-clause BSD style licence - see the LICENCE file.

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-intercept-remote-1.1.tar.gz (6.9 kB view hashes)

Uploaded Source

Built Distribution

pytest_intercept_remote-1.1-py3-none-any.whl (5.1 kB view hashes)

Uploaded Python 3

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