{"categories":[{"label":"Testing","url":"https://skillfed.io/packages/category/software-development-testing"}],"enrichment":{"capability":"A pytest plugin that blocks or restricts socket calls during tests, preventing unintended network access and DNS resolution while allowing selective allowlisting of hosts or Unix domain sockets.","skillfed_tags":["test-isolation","network-mocking"],"use_cases":["Catch tests that accidentally make real HTTP requests to external APIs instead of using mocks.","Enforce network isolation in CI/CD pipelines to ensure tests don't depend on external services.","Allow specific tests to connect to localhost or a test server while blocking all other network access.","Verify that async code using Unix domain sockets works correctly while blocking TCP/UDP calls.","Prevent DNS resolution during tests to catch hardcoded hostnames or missing mock setup."],"what_it_does":"pytest-socket is a pytest plugin that intercepts Python's socket interface to prevent network calls during test execution. It works by globally disabling socket access or by restricting connections to an allowlist of specific hosts, IP addresses, or CIDR ranges. You can apply these restrictions via CLI flags (like `--disable-socket`), pytest configuration files, or per-test via fixtures and markers.\n\nThe plugin is useful for ensuring tests remain isolated and deterministic by catching accidental or unintended network dependencies. It supports selective allowlisting, Unix domain socket access for async testing, and per-test overrides. The plugin has been actively maintained since 2017 and supports Python 3.10 through 3.14.","worth_installing":"Yes. This is a focused, well-maintained tool with low install friction and no security issues. It solves a real problem\u2014preventing accidental network calls in tests\u2014and integrates cleanly with pytest via CLI flags, config, or fixtures. The MIT license is permissive and the active maintenance (recent release, active repo) makes it reliable for production test suites."},"id":"pytest-socket","links":{"html":"https://skillfed.io/packages/pytest-socket","md":"https://skillfed.io/packages/pytest-socket.md","pypi":"https://pypi.org/project/pytest-socket/"},"maintenance":{"status":"active"},"meta":{"latest_release":"2026-05-21","license_spdx":"MIT","license_treatment":"permissive","name":"pytest-socket","python_support":"supports_current","summary":"Pytest Plugin to disable socket calls during tests"},"popularity":{"monthly_downloads":13881633,"position":1260,"tier":"top_5000"},"security":{"n_vulnerabilities":0},"version":"0.8.0"}
