Skip to content

0.1.0

Choose a tag to compare

@claudiubelu claudiubelu released this 17 May 18:51
· 20 commits to main since this release

Initial release.

mockey is a Python fixture library that enforces correct mock.patch autospec behaviour, surfacing signature violations that the standard unittest.mock library silently ignores.

Features:

  • Global autospec injection via patch_mock_module() - autospec=True is automatically applied to every mock.patch / mock.patch.object / mock.patch.multiple call, no per-patch opt-in required
  • mock.Mock(autospec=...) support via MockAutospecFixture - adds an autospec= keyword to Mock() / MagicMock() constructors with full signature and attribute enforcement
  • Return-value autospeccing - methods annotated -> SomeClass return an autospecced SomeClass mock automatically; methods annotated -> None return actual None
  • Constructor signature enforcement - calling mock.Mock(autospec=MyClass)(wrong_args) raises
    TypeError

Full Changelog: https://github.com/claudiubelu/mockey/commits/0.1.0