Contents

pytest-socket 0.7.0

0

Pytest Plugin to disable socket calls during tests

A plugin to use with Pytest to disable or restrict socket calls during tests to ensure network calls are prevented.

Stars: 287, Watchers: 287, Forks: 42, Open Issues: 7

The miketheman/pytest-socket repo was created 7 years ago and the last code push was Yesterday.
The project is popular with 287 github stars!

How to Install pytest-socket

You can install pytest-socket using pip

pip install pytest-socket

or add it to a project with poetry

poetry add pytest-socket

Package Details

Author
Mike Fiedler
License
MIT
Homepage
https://pypi.org/project/pytest-socket/
PyPi:
https://pypi.org/project/pytest-socket/
GitHub Repo:
https://github.com/miketheman/pytest-socket

Classifiers

  • Software Development/Testing
No  pytest-socket  pypi packages just yet.

Errors

A list of common pytest-socket errors.

Code Examples

Here are some pytest-socket code examples and snippets.

GitHub Issues

The pytest-socket package has 7 open issues on GitHub

  • feat(allow_hosts): add support for hostname resolution
  • Improve fixtures to not affect other tests
  • feat: support cidr blocks in –allow-hosts
  • Give socket_allow_hosts the ability to handle AF_UNIX sockets
  • ability to specify different exception instead of custom SocketBlockedError
  • Disable gethostbyname and getaddrinfo too.
  • Ability to block by socket number ?
  • Feature request: Also block DNS lookups (socket.getaddrinfo)
  • Automatic skips for tests using sockets
  • pypy3 hangs on threading

See more issues on GitHub

Related Packages & Articles

pytest-aoc 1.23.4

Downloads puzzle inputs for Advent of Code and synthesizes PyTest fixtures