$npx skillfedfor your agent

mock-alchemy

SQLAlchemy mock helpers.

With conditionsPyPI TestingReleased Mar 2023153.0K downloads / moMITPure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — mock_alchemy-0.2.6-py3-none-any.whl
v0.2.6 · released 2023-03-26 · Python >=3.7,<4.0 · 1 runtime deps: SQLAlchemy

Yes, if you are already using SQLAlchemy and need to mock sessions in unit tests without database access. The low install friction and permissive license make it straightforward to adopt. However, be aware that maintenance is dormant—last release was 2023-03-26—so compatibility with very recent SQLAlchemy versions is uncertain. Test against your specific SQLAlchemy version before relying on it in production test suites.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires Python 3.7 or later (supports 3.7–3.11); SQLAlchemy must be installed separately.
  • Low friction: pure Python wheel with only SQLAlchemy as a runtime dependency.
  • Maintenance is dormant—last release was 2023-03-26 and last commit 2023-11-01—so expect no active bug fixes or feature updates.

License · maintenance · safety

MIT (permissive) — MIT license (permissive) means you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.

last release 2023-03-26 (1237 days) · last repo commit 2023-11-01 · 80 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 152,987 downloads/mo, #10,890 on PyPI

Verify before relying

pip install mock-alchemy

from mock_alchemy.mocking import UnifiedAlchemyMagicMock
session = UnifiedAlchemyMagicMock()
session.query(Model).filter(Model.foo == 5).all()
session.filter.assert_has_calls([mock.call(Model.foo == 5)])
  • Whether the dormant maintenance status affects compatibility with recent SQLAlchemy versions (1.4+, 2.0+).
  • Whether the partial filtering and deletion limitations documented in the description are acceptable for your test scenarios.
Same gist for agents: .md · .json

What it is and what it does

mock-alchemy wraps SQLAlchemy's session object with mock helpers that let you assert on query and filter calls during unit tests without touching a real database. It provides three main tools: ExpressionMatcher for comparing SQLAlchemy binary expressions, AlchemyMagicMock for basic session mocking, and UnifiedAlchemyMagicMock for more complex scenarios where a session is queried multiple times with different filters. The library also supports stubbing real data by query criteria and partially fakes session mutations like add() and delete().

The package is lightweight—it depends only on SQLAlchemy—and installs as a pure Python wheel. However, it has been dormant since early 2023, with no recent commits or releases, so it may not track the latest SQLAlchemy API changes. It is classified as Pre-Alpha and is best suited for teams already committed to its design patterns.

Use it for

  • Assert that your code calls session.query() and filter() with the correct model and conditions during unit tests.
  • Stub test data by matching specific query and filter call sequences, returning different results for different filter combinations.
  • Verify that add() and delete() operations are called on the session without running actual database migrations.
  • Test query logic in isolation by mocking the session layer and checking filter expressions are built correctly.

Worth the install?

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

With conditions

Yes, if you are already using SQLAlchemy and need to mock sessions in unit tests without database access.

The low install friction and permissive license make it straightforward to adopt. However, be aware that maintenance is dormant—last release was 2023-03-26—so compatibility with very recent SQLAlchemy versions is uncertain. Test against your specific SQLAlchemy version before relying on it in production test suites.

Install

mock-alchemy on PyPI

Before you install

Low friction: pure Python wheel with only SQLAlchemy as a runtime dependency. Maintenance is dormant—last release was 2023-03-26 and last commit 2023-11-01—so expect no active bug fixes or feature updates.

Requires Python 3.7 or later (supports 3.7–3.11); SQLAlchemy must be installed separately.

License in practice

MIT license (permissive) means you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.

Quickstart

pip install mock-alchemy

from mock_alchemy.mocking import UnifiedAlchemyMagicMock
session = UnifiedAlchemyMagicMock()
session.query(Model).filter(Model.foo == 5).all()
session.filter.assert_has_calls([mock.call(Model.foo == 5)])

Verify before relying

  • Whether the dormant maintenance status affects compatibility with recent SQLAlchemy versions (1.4+, 2.0+).
  • Whether the partial filtering and deletion limitations documented in the description are acceptable for your test scenarios.

Package facts

LicenseMIT permissive
Python supportSupports the current Python release >=3.7,<4.0
Install frictionLow. Pure-Python wheel
Runtime dependencies
1 package
SQLAlchemy
MaintenanceDormant 1,237 days since the last release
Last repo commit
First released
Downloads152,987 / month, #10,890 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 2 - Pre-AlphaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Evidence: mock_alchemy-0.2.6-py3-none-any.whl

Tags

Capabilities
sqlalchemy mock testingmock sqlalchemy sessionunit test database mockingsqlalchemy query assertionstest fixtures sqlalchemyfake database session
Topics
sqlalchemy-testingmock-helpers
PyPI keywords
sqlalchemy mock testingsqlalchemy mockmock sqlalchemy

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 › “mock sqlalchemy session”

  • mock-alchemyProvides mock helpers for SQLAlchemy sessions in unit tests, enabling…
  • alchemy-mockProvides mock helpers for SQLAlchemy sessions and expression matchers…
  • pytest-mock-resourcesProvides pytest fixtures that spin up real database and service…

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 alchemy-mock · django-mock-queries · pytest-mock-resources · sqlalchemy-mixins · flexmock · sqlalchemy-filters · sqlalchemy-easy-softdelete · sqltap · zope.sqlalchemy · asyncmock