Skip to main content

pytest-intercept-remote

Python versions supported License

build Code coverage Package stability PyPi version

This package provides a plugin for pytest framework for intercepting outgoing connection requests during test runs.

Installation

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

$ pip install pytest-intercept-remote

or by:

$ 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.

Configuration

The default dump file is .intercepted which can be overridden by:

  • either specifing intercept_dump_file in the ini file

  • or by adding -o intercept_dump_file=[dump file] option

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

Usage

Intercepting requests

The urls can be intercepted using --intercept-remote option;

$ pytest --intercept-remote

The tests trying to connect to internet will xfail.

Remote status

Once the requests are intercepted, they can be pinged for their status by using --remote-status=[show/only/no] option.

  • --remote-status=show will append the ping functions to pytest run;

  • --remote-status=only will only ping the requests and deselect all other tests;

$ pytest --remote-status=show
$ pytest --remote-status=only

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.

Release files for pytest-intercept-remote 1.25

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-intercept-remote 1.25
File Size Uploaded
pytest-intercept-remote-1.25.tar.gz 9.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-intercept-remote 1.25
File Interpreter ABI Platform
pytest_intercept_remote-1.25-py3-none-any.whl Python 3 none any Details

Total release size: 17.1 kB

Release files / pytest-intercept-remote-1.25.tar.gz

Download URL pytest-intercept-remote-1.25.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
3e8dfcf1f6b709e277679feaf6fb612241e5cb90d67b8d49d7c948ad3748349a
BLAKE2b-256 checksum
How to use checksums
7dbf8c56e502dc047b2916795fa73de1666b3feb06ec6df4034c49b8fdf29dec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.10

Release files / pytest_intercept_remote-1.25-py3-none-any.whl

Download URL pytest_intercept_remote-1.25-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f314b2ebca1c2e890f4f60c877f2ee3d0104bb7c370ef4c4341650aff56e54e9
BLAKE2b-256 checksum
How to use checksums
067571444ea43df66a749648e7a7b43f3db798e458a4fad0a4b5a9ae3fe7d196
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.10

Release history Release notifications | RSS feed

This release

1.25 This release

2 release files

1.24

2 release files

1.2

2 release files

1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page