Skip to content

habemus-papadum/fire-prox

Repository files navigation

Fire-Prox

CI Coverage Documentation Python 3.12+ License: MIT Code style: ruff

Setup

Before running tests or using the project, make sure to install all dependencies:

# Install Python dependencies
uv sync --frozen

# Install Node.js dependencies (for Firebase tools)
pnpm install

Testing

The project includes a flexible test runner that makes it easy to pass additional parameters to pytest while running Firebase emulators. The test runner launches a local Firestore emulator that Python code is configured to interact with by default and then tears down the emulator once the unit tests are done.

VSCode & Demo Notebooks

For running test in vscode or using the demo notebooks, you need to launch the developer emulator using pnpm developer-emulator.

Running Tests

You can run tests in several ways:

# Using the bash script directly
./test.sh

# Using npm/pnpm (calls the bash script)
pnpm test

# With additional pytest parameters
./test.sh -v                     # Verbose output
./test.sh -k test_specific       # Run specific test
./test.sh --tb=short            # Short traceback format
./test.sh -v -k test_fire_prox  # Combine multiple options

The test script automatically starts Firebase emulators and runs your tests within that environment, then cleans up afterward.

Firestore Test Harness

Tests can rely on the firestore_test_harness pytest fixture (published in fire_prox.testing) to ensure the emulator database is fully deleted both before a test starts and after it finishes. The harness can also be used as a context manager when writing ad-hoc scripts:

from google.cloud import firestore
from fire_prox.testing import firestore_harness

with firestore_harness() as harness:
    client = firestore.Client(project=harness.project_id)
    # interact with Firestore here

About

prototyping focused proxy for Firestore

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •