{"categories":[{"label":"Python Modules","url":"https://skillfed.io/packages/category/software-development-libraries-python-modules/18"},{"label":"Quality Assurance","url":"https://skillfed.io/packages/category/software-development-quality-assurance/3"}],"enrichment":{"capability":"A flake8 plugin that enforces the use of the spec or spec_set argument when creating mock objects, helping catch bugs from incorrectly specified mocks.","skillfed_tags":["testing","mock-validation","flake8-plugin"],"use_cases":["Catch bugs in unit tests where mocks are called with methods that don't exist on the real object, preventing false test passes.","Enforce team standards that all mocks must declare their spec to keep test code aligned with actual interfaces.","Validate patch operations in test suites to ensure they include spec or autospec arguments for safer mocking.","Integrate mock validation into CI/CD pipelines via flake8 to fail builds when mocks are created without spec constraints."],"what_it_does":"flake8-mock-spec is a linter plugin for flake8 that detects when unittest.mock objects (Mock, MagicMock, NonCallableMock, AsyncMock) are created without a spec or spec_set argument, and when patch operations lack spec-related arguments. It enforces a best practice: mocks should declare what interface they conform to, preventing tests from passing when they access methods or attributes that don't exist on the real object being mocked.\n\nThe plugin defines seven linting rules (TMS010\u2013TMS013 for mock construction, TMS020\u2013TMS022 for patch operations) that can be selectively suppressed. It integrates directly into your flake8 workflow with no additional configuration required beyond installation. However, the package has been abandoned since its single release in January 2023, meaning no updates or maintenance will occur.","worth_installing":"Yes, if you are already using flake8 and want to catch mock misuse in your test suite. The plugin is lightweight, has no complex dependencies, and solves a real problem. However, be aware that it is abandoned and will not receive updates or bug fixes\u2014if you encounter issues with newer versions of flake8 or Python, you will need to maintain or fork it yourself."},"id":"flake8-mock-spec","links":{"html":"https://skillfed.io/packages/flake8-mock-spec","md":"https://skillfed.io/packages/flake8-mock-spec.md","pypi":"https://pypi.org/project/flake8-mock-spec/"},"maintenance":{"status":"abandoned"},"meta":{"latest_release":"2023-01-14","license_spdx":null,"license_treatment":"permissive","name":"flake8-mock-spec","python_support":"supports_current","summary":"A linter that checks mocks are constructed with the spec argument"},"popularity":{"monthly_downloads":127524,"position":11739,"tier":"top_15000"},"security":{"n_vulnerabilities":0},"version":"1.4.0"}
