{"categories":[{"label":"Software Development","url":"https://skillfed.io/packages/category/software-development/2"},{"label":"Python Modules","url":"https://skillfed.io/packages/category/software-development-libraries-python-modules/3"},{"label":"Testing","url":"https://skillfed.io/packages/category/software-development-testing"}],"enrichment":{"capability":"kgb intercepts and records function calls in unit tests, letting you verify how many times a function was called and with what arguments, while optionally blocking, rerouting, or allowing the original call to proceed.","skillfed_tags":["testing","spies","unittest"],"use_cases":["Verify that a method was called with specific arguments without mocking the entire object","Count how many times a function is invoked during a test to ensure it's not called more than expected","Block a function call in tests (e.g., prevent side effects) while still recording that it was attempted","Reroute a function to a fake implementation to test error handling or alternative behavior","Track the sequence and details of multiple function calls across a test to verify interaction order"],"what_it_does":"kgb is a spy library for Python unit tests that intercepts function calls without requiring you to write mock objects. When you spy on a function, kgb records every call\u2014its arguments, return value, and any exceptions\u2014and lets you query that history in your test assertions. You can configure a spy to call the original function, block it entirely, or reroute it to a fake function you provide.\n\nThe library integrates with unittest, pytest, nose, and nose2, and can be used as a mixin in test classes, a context manager for quick one-off spies, or through a SpyAgency object that manages multiple spies. It has no runtime dependencies and installs as a pure Python wheel, making it lightweight and easy to add to any test suite.","worth_installing":"Yes. kgb is a lightweight, actively maintained testing utility with no dependencies, permissive licensing, and a clean API for function call verification. It's well-suited for any Python test suite that needs spy functionality without the overhead of full mocking frameworks."},"id":"kgb","links":{"html":"https://skillfed.io/packages/kgb","md":"https://skillfed.io/packages/kgb.md","pypi":"https://pypi.org/project/kgb/"},"maintenance":{"status":"active"},"meta":{"latest_release":"2025-12-11","license_spdx":null,"license_treatment":"permissive","name":"kgb","python_support":"supports_current","summary":"Utilities for spying on function calls in unit tests."},"popularity":{"monthly_downloads":9403872,"position":1536,"tier":"top_5000"},"security":{"n_vulnerabilities":0},"version":"7.3"}
