mock-firestore
In-memory implementation of Google Cloud Firestore for use in tests
What it is and what it does
mock-firestore is an in-memory implementation of the Google Cloud Firestore Python client, designed to replace the real client in unit tests. It mimics the same API surface—collections, documents, queries, transactions, and field transforms—so test code can use it as a drop-in substitute without hitting the live Firestore service. The package has no runtime dependencies and installs cleanly.
The implementation is partial; not every Firestore operation is supported, but the description lists a substantial set of working operations including document CRUD, collection traversal, filtering with where clauses, ordering, limits, cursors, and transaction support. It's useful for fast, isolated unit tests where you need a Firestore-like interface but don't want network calls or cloud infrastructure. Reset the mock with reset() to clear state between tests.
Use it for:
- Unit test a Python application that uses Firestore without spinning up a real database or incurring cloud costs.
- Develop and test Firestore queries and transactions locally before deploying to production.
- Mock Firestore in CI/CD pipelines to run tests in parallel without database contention.
- Test error handling and edge cases in Firestore code without risking real data.
- Prototype Firestore-backed features before committing to cloud infrastructure.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides an in-memory mock of the Google Cloud Firestore Python client for use in unit tests, supporting collections, documents, queries, transactions, and field transforms without requiring a live database.
Yes, if you are testing code that uses Firestore and want a lightweight, zero-dependency mock. The package is dormant (last release January 2022) but has no known vulnerabilities and works for its stated purpose. Install it only if your Firestore client API usage aligns with the partial feature set documented; verify coverage of the operations your code relies on before committing to it in your test suite.
Install
mock-firestore on PyPI
pip
pip install mock-firestoreuv
uv add mock-firestorepoetry
poetry add mock-firestoreInstalling mock-firestore
Before you install
Low install friction with no runtime dependencies. Maintenance is dormant—last release was in January 2022 and the last commit in August 2024, so the package is not actively developed but remains available and functional for its stated purpose.
License in practice
Licensed under MIT (permissive), so you can use it freely in commercial and private projects with minimal restrictions.
Quickstart
pip install mock-firestore
from mock_firestore import MockFirestore
mock_db = MockFirestore()
mock_db.collection('users').document('alice').set({'name': 'Alice'})
doc = mock_db.collection('users').document('alice').get()
print(doc.to_dict())
Python 3.6+ is required.
Verify before relying
- Extent of API coverage relative to the current Python Firestore client library—description notes 'only a partial implementation'.
- Whether dormant maintenance (last release January 2022) poses a risk if Firestore client API has evolved significantly since then.
Package facts
| License | not declared (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | dormant — 1,663 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 139,644/month — #11,293 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: mock_firestore-0.11.0-py3-none-any.whl
Tags
More Testing packages
Pluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
virtualenvvirtualenv creates isolated Python environments…
permissive · top 100 on PyPI
coverageCoverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
pytest-asynciopytest-asyncio is a pytest plugin that enables…
permissive · top 1,000 on PyPI
pytest-json-ctrfA pytest plugin that generates test reports in…
permissive · top 1,000 on PyPI
google-cloud-firestorePython client library for Google Cloud…
permissive · top 1,000 on PyPI
pyfakefspyfakefs mocks the Python file system modules…
permissive · top 5,000 on PyPI
flexmockflexmock creates mock, stub, spy, and fake…
permissive · top 15,000 on PyPI
django-mock-queriesMocks Django QuerySet operations in memory for…
permissive · top 15,000 on PyPI
firebase-adminFirebase Admin Python SDK provides server-side…
permissive · top 1,000 on PyPI
motoMoto mocks AWS services for testing, allowing…
permissive · top 1,000 on PyPI
aiomotoProvides async-compatible AWS service mocks for…
permissive · top 15,000 on PyPI
mock-openProvides a drop-in replacement for…
permissive · top 15,000 on PyPI
moto-extMocks AWS services for testing by intercepting…
permissive · top 15,000 on PyPI
asynctestExtends Python's unittest module with test…
permissive · top 5,000 on PyPI