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.1.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: fakebigtable-0.1.1.tar.gz
  • Upload date:
  • Size: 2.8 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.1.tar.gz
Algorithm Hash digest
SHA256 1318524444409bb8deddbc05d40abe37738418efe3c442c38a410e7fcdc7f7a5
MD5 623d2c300164f1f209b0aa7b152885e5
BLAKE2b-256 0be936c62ad6f61a29746c582db2abb780ad8e2f0195b2dd9c6a4d49f00ce3cb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fakebigtable-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 879b019f181306fdb638c4c2d963fdc146893b585301887c31ef33a0da98041b
MD5 895638ada079c16a49375ae94901a7ae
BLAKE2b-256 7016a32f52b76e798a1ad67854229239779425326751feb5e1d8edda4d707986

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