skillfed

mock-firestore

In-memory implementation of Google Cloud Firestore for use in tests

mock-firestore v0.11.0 139.6K downloads/30d#11,293 on PyPI79
Permissive license DORMANT released

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-firestore

uv

uv add mock-firestore

poetry

poetry add mock-firestore

Installing 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

License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

firestore mock testingin-memory firestorefirestore test doublefirestore unit testmock google cloud firestorefirestore fake databasefirestore testing library
firestoretestingmock

More Testing packages