$npx skillfedfor your agent

flexmock

flexmock is a testing library for Python that makes it easy to create mocks, stubs and fakes.

Worth itPyPI TestingReleased Jan 2026149.0K downloads / moBSD-2-ClausePure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — flexmock-0.13.0-py3-none-any.whl
v0.13.0 · released 2026-01-10 · Python <4.0.0,>=3.10.0

Yes. flexmock is actively maintained, has no external dependencies, supports current Python versions (3.10+), carries a permissive license, and integrates seamlessly with all major test runners. It's a solid choice if you prefer readable, English-like mock declarations over the standard library's unittest.mock API.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires Python 3.10 or later (supports 3.10, 3.11, 3.12, 3.13, 3.14, and PyPy3).
  • Low friction install with no runtime dependencies.
  • Actively maintained as of 2026-01-10, last commit 2026-08-09, and marked Production/Stable.

License · maintenance · safety

BSD-2-Clause (permissive) — BSD-2-Clause permissive license allows broad use, modification, and distribution with minimal restrictions.

last release 2026-01-10 (216 days) · last repo commit 2026-08-09 · 65 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 149,003 downloads/mo, #11,007 on PyPI

Verify before relying

pip install flexmock

from flexmock import flexmock

flexmock(SomeClass).should_receive("method_name").and_return("value").once()
  • Whether the English-like declaration syntax is genuinely easier to learn than unittest.mock for developers new to mocking.
  • Real-world performance characteristics when mocking complex object hierarchies or large test suites.
Same gist for agents: .md · .json

What it is and what it does

flexmock is a testing library that lets you create mock, stub, spy, and fake objects for unit testing without pulling in external dependencies. It reads like English sentences rather than API calls—for example, you can write `flexmock(Train).should_receive("get_destination").and_return("Paris").once()` to assert that a method is called exactly once with a specific return value. The library works with unittest, pytest, and doctest out of the box, and its entire public API is type-annotated for editor support and static analysis.

You use flexmock when you need to isolate code under test by replacing real objects with controlled doubles. Mocks let you verify that methods were called with expected arguments; spies let you wrap the real method and check how many times it ran; stubs replace parts of objects or classes; and fakes generate placeholder objects. Since it has no external dependencies and only uses the Python standard library, it's lightweight and straightforward to add to any test suite.

Use it for

  • Verify that a method was called with specific arguments and return value in a unit test.
  • Spy on real method calls to count invocations or check they never happen with certain inputs.
  • Replace a database or API client with a stub to test business logic in isolation.
  • Generate fake objects to populate test fixtures without writing boilerplate classes.
  • Assert that exception-raising methods are called the correct number of times.
  • Test code that depends on external services by mocking their interfaces.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Worth it

Yes.

flexmock is actively maintained, has no external dependencies, supports current Python versions (3.10+), carries a permissive license, and integrates seamlessly with all major test runners. It's a solid choice if you prefer readable, English-like mock declarations over the standard library's unittest.mock API.

Install

flexmock on PyPI

Before you install

Low friction install with no runtime dependencies. Actively maintained as of 2026-01-10, last commit 2026-08-09, and marked Production/Stable.

Requires Python 3.10 or later (supports 3.10, 3.11, 3.12, 3.13, 3.14, and PyPy3).

License in practice

BSD-2-Clause permissive license allows broad use, modification, and distribution with minimal restrictions.

Quickstart

pip install flexmock

from flexmock import flexmock

flexmock(SomeClass).should_receive("method_name").and_return("value").once()

Verify before relying

  • Whether the English-like declaration syntax is genuinely easier to learn than unittest.mock for developers new to mocking.
  • Real-world performance characteristics when mocking complex object hierarchies or large test suites.

Package facts

LicenseBSD-2-Clause permissive
Python supportSupports the current Python release <4.0.0,>=3.10.0
Install frictionLow. Pure-Python wheel
Runtime dependenciesNone
MaintenanceActively maintained 216 days since the last release
Last repo commit
First released
Downloads149,003 / month, #11,007 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: TestingTopic :: Software Development :: Testing :: MockingTopic :: Software Development :: Testing :: UnitTyping :: Typed

Evidence: flexmock-0.13.0-py3-none-any.whl

Tags

Capabilities
python mocking librarymock objects testingspy and stub frameworkpytest mock alternativeunittest mock replacementfake object generatortest double creation
Topics
testingmockingtype-annotated
PyPI keywords
mocktestingtestunittestpytest

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “spy and stub framework”

  • flexmockflexmock creates mock, stub, spy, and fake objects for testing Python…
  • mockitoMockito is a spying and stubbing framework for Python that lets you…
  • pytest-mockProvides a pytest fixture that wraps the mock library's patching API,…

Give your agent the search over MCP, or paste the wish link into any chat.

More Testing packages

pluggy Worth it
PyPI · Libraries · released May 2025

Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.

Install it if you're building an extensible application or framework.

MITpure Python · 3.9+aging
1.3Bdownloads / mo
pytest Worth it
PyPI · Libraries · released Jun 2026

pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.

MITpure Python · 3.10+
1.1Bdownloads / mo
virtualenv Worth it
PyPI · Libraries · released Aug 2026

virtualenv creates isolated Python environments where packages can be installed independently without affecting the system Python or other projects.

MITpure Python · 3.9+
532.9Mdownloads / mo
coverage Worth it
PyPI · Testing · released Aug 2026

Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.

Install it if you want to measure test completeness or enforce coverage thresholds in your project.

permissive licensepure Python · 3.10+
335.8Mdownloads / mo
pytest-asyncio Worth it
PyPI · Testing · released May 2026

pytest-asyncio is a pytest plugin that enables writing and running async test functions using the asyncio library, allowing developers to await code directly within test cases.

Install it if you write tests for any asyncio-based code.

Apache-2.0pure Python · 3.10+
275.9Mdownloads / mo
pytest-json-ctrf Worth it
PyPI · Testing · released Jul 2026

A pytest plugin that generates test reports in Common Test Report Format (CTRF) as JSON, compatible with pytest-xdist and pytest-playwright for distributed and browser-based testing.

Install it if you need CTRF-formatted test output for CI/CD integration or cross-tool reporting.

MITpure Python · 3.8+
273.0Mdownloads / mo

See also mockito · pretend · pytest-mock · wiremock · stubs · pytest-stub · TestSlide · mock · pyfakefs · mock-firestore