A flake8 plugin that ensures mocks are constructed with the `spec` argument, preventing fragile tests. Version 1.4.0 supports Python 3.8+ and requires flake8. It has a release cadence of roughly once a year.
pip install flake8-mock-specNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Run flake8 after installing the plugin to catch missing spec arguments in mock constructors.
Ensure you also manually check patches; use spec parameter in patch calls where appropriate.
Upgrade to the latest version and ensure Python >=3.8.1.
Add spec=YourClass to the mock constructor, e.g., Mock(spec=MyClass).