Pytest Plugin to disable socket calls during tests

pytest-socket A plugin to use with Pytest to disable or restrict socket calls during tests to ensure network calls are prevented. Features Disables all network calls flowing through Python's socket interface. Requirements Pytest 6.2.5 or greater Installation You can install pytest-socket via pip from PyPI: pip install pytest-socket or add to your pyproject.toml for poetry: [tool.poetry.dev-dependencies] pytest-socket = "*" Usage Run pytest --disable-socket, tests should fail on any access to socket or libraries using socket with a SocketBlockedError. To add this flag as the default behavior, add this section to your pytest.ini: [pytest] addopts = --disable-socket or add this to your setup.cfg: [tool:pytest] addopts = --disable-socket or update your conftest.py to include: from pytest_socket import disable_socket def pytest_runtest_setup(): disable_socket() If you exceptionally want to enable socket for one particular execution pass --force-enable-socket. It takes
RPM
python3-pytest-socket-0.7.0-1.lbn42.noarch.rpm
Summary
Pytest Plugin to disable socket calls during tests
URL
https://pypi.org/project/pytest-socket
Group
Unspecified
License
ZPL
Source
python-pytest-socket-0.7.0-1.lbn42.src.rpm
Checksum
d077cf2d57077c08f54694c3d3c2021c0e9786b5a012a46b47c52e31667f0d03
Signing Signature
RSA/SHA512, Sun 05 Apr 2026 06:30:09 PM AEST, Key ID d760880122ab8392
Build Date
2025/09/13 10:43:29
Requires
python3.13dist(pytest) >= 6.2.5
Provides
python-pytest-socket = 0.7.0-1.lbn42
python3-pytest-socket = 0.7.0-1.lbn42
python3.13-pytest-socket = 0.7.0-1.lbn42
python3.13dist(pytest-socket) = 0.7
python3dist(pytest-socket) = 0.7
Obsoletes