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

Uploaded Source

Built Distribution

fakebigtable-0.1.5-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fakebigtable-0.1.5.tar.gz
  • Upload date:
  • Size: 3.3 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.5.tar.gz
Algorithm Hash digest
SHA256 dd45d11a485efbec3690a1ea92ef54707ac50cd12c5a599e34a2af68f6d38bef
MD5 4106a6686ff54d97337d017df95c9464
BLAKE2b-256 4559023dd28e454955850c8bab6270efbf6acef160417bc8396c4eec254ba238

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fakebigtable-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 3.8 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 24aa822c79511726c3d406dea98ee7892ff7eb8abd48743cf64e14b6d909d741
MD5 959e6f271c029a27e2da0537247ed617
BLAKE2b-256 e3481ab7bdafa3c7e626ff3dcc270742557f9af4e54ea684a536d1b005a86d84

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