Skip to main content

Fakes bigtable ops for tests

Project description

fakebigtable

A mock implementation of Google Cloud Bigtable client for testing for when the overhead of using the emulator is too much for a small project. Unit tests are written to prove emulator parity. We use the emulator so you don't have to.

Install

pip install fakebigtable

Usage with pytest

import pytest
from google.cloud import bigtable
from fakebigtable import FakeBigtableClient

@pytest.fixture(autouse=True)
def mock_bigtable(monkeypatch):
    monkeypatch.setattr(bigtable, "Client", FakeBigtableClient)

def test_bigtable_operations():
    client = bigtable.Client(project="test-project")
    instance = client.instance("test-instance")
    table = instance.table("test-table")
    # Perform operations on table

Usage with unittest

import unittest
from unittest.mock import patch
from google.cloud import bigtable
from fakebigtable import FakeBigtableClient

class TestBigtableOperations(unittest.TestCase):
    @patch('google.cloud.bigtable.Client', FakeBigtableClient)
    def test_bigtable_operations(self):
        client = bigtable.Client(project="test-project")
        instance = client.instance("test-instance")
        table = instance.table("test-table")
        # Perform operations on table

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fakebigtable-0.1.2.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

fakebigtable-0.1.2-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file fakebigtable-0.1.2.tar.gz.

File metadata

  • Download URL: fakebigtable-0.1.2.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.3 Windows/10

File hashes

Hashes for fakebigtable-0.1.2.tar.gz
Algorithm Hash digest
SHA256 cabcd73624662e623c5f763854262d8a94b263e7cb99af38dd57739f64d120a2
MD5 a8f4dec25ee57ddf8c5ae3c4a6673d5f
BLAKE2b-256 52af40276cb7c135c4b25073462d2be185e4ae341b5b945f8a8f200459035c87

See more details on using hashes here.

File details

Details for the file fakebigtable-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: fakebigtable-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.3 Windows/10

File hashes

Hashes for fakebigtable-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 798b3a9dbc332b05ec7ddff9e06c57be965b1a67ec973bef12e1a9f63422ecdc
MD5 a55a9dee0053d547401b2d878ff0afa2
BLAKE2b-256 9bbc72b946a03fd7b2a81934f0b75acc5d73a0aead14d39b87c515e61ec8a1e0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page