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

Uploaded Source

Built Distribution

fakebigtable-0.1.4-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fakebigtable-0.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 ed449a9367fd23a3f1878a54cad8dc4e5fa00db6b2cc88786113e307a074e32d
MD5 b233ac817bb012d9a9cad4624762f1cb
BLAKE2b-256 3265aa760e97d47209643f648ec8c8b1029203dea1e6c3088035e19e3a2b9e2d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fakebigtable-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 3.7 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 5444206b1d677d57c00b2e839535cf1b2f7372a563b1ae08306510493d909c70
MD5 4155dee05b7d447661627a6cc911a3e9
BLAKE2b-256 d4b833abef56df9b8e8ff805bf4ef8a46b6644ac632f9a133d4bb0fb8c8b3408

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