--- id: alchemy-mock version: "0.4.3" license: MIT license_treatment: permissive maintenance: abandoned --- # alchemy-mock — SQLAlchemy mock helpers. License: permissive · Maintenance: abandoned · Downloads: 223.1K/mo ## What it is and what it does alchemy-mock provides utilities to mock SQLAlchemy sessions and query expressions in unit tests, eliminating the need to access a real database during testing. It includes ExpressionMatcher for comparing SQLAlchemy binary expressions (which normally produce another expression rather than a boolean), AlchemyMagicMock for basic session mocking, and UnifiedAlchemyMagicMock for more complex scenarios where sessions are queried multiple times with different filters. The library can stub real data by filtering criteria and partially supports session mutations like add() and add_all(). The package depends on six, sqlalchemy, and setuptools. It is classified as Pre-Alpha and has not been maintained since early 2021, with the last release in November 2019. While it has modest popularity, the abandoned status means bug fixes and compatibility updates are unlikely. Use it for: - Unit test SQLAlchemy-based code without spinning up a test database or fixtures. - Assert that query filters were applied correctly by comparing filter expressions directly. - Stub query results based on specific filter criteria to test conditional logic in data access layers. - Mock session.add() and session.query() calls to verify ORM operations without persistence. - Test complex multi-filter query chains by unifying and inspecting all filter calls together. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides mock helpers for SQLAlchemy sessions and expression matchers to enable unit testing without database access while preserving assertion capabilities. Yes, but with caution. The package solves a real testing problem and has low install friction, but it is abandoned and has not been updated since 2021. Install it only if your SQLAlchemy and Python versions are compatible with its last release, and only if you are willing to maintain a fork or workaround if compatibility breaks. For new projects, consider actively maintained alternatives. ## Install pip install alchemy-mock uv add alchemy-mock poetry add alchemy-mock ## Installing alchemy-mock Before you install: Low install friction with three lightweight runtime dependencies. However, the package is abandoned—last release was 2019-11-05 and last commit 2021-01-07. No active maintenance means compatibility issues with newer SQLAlchemy or Python versions are unlikely to be addressed. License in practice: MIT license is permissive and poses no restrictions on use, modification, or distribution in commercial or private projects. Quickstart: pip install alchemy-mock from alchemy_mock.mocking import UnifiedAlchemyMagicMock session = UnifiedAlchemyMagicMock() m = session.query(Model) q = m.filter(Model.foo == 5) data = q.all() Requires SQLAlchemy to be installed; package is abandoned and may have compatibility issues with modern SQLAlchemy or Python versions. Verify before relying: - Compatibility with SQLAlchemy versions released after 2021-01-07 is not documented. - Whether the package works with Python versions beyond 3.6 is unclear given the abandoned status. - Current real-world usage patterns and whether the package remains functional with modern dependencies. ## Package facts - License: MIT (permissive) - Python support: unspecified - Install friction: low - Maintenance: abandoned - Downloads: 223.1K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags sqlalchemy mock testing, mock database session, sqlalchemy unit test, expression matcher, database mock helpers, sqlalchemy test doubles, query mocking, sqlalchemy-testing, abandoned [View on SkillFed](https://skillfed.io/packages/alchemy-mock) · [View on PyPI](https://pypi.org/project/alchemy-mock/)