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.3.tar.gz
(3.3 kB
view details)
Built Distribution
File details
Details for the file fakebigtable-0.1.3.tar.gz
.
File metadata
- Download URL: fakebigtable-0.1.3.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49b370e64e98343a0d85fc1c4d0ace03f0127c2b192646ab0caea5c20740e619 |
|
MD5 | e0058f1605b228e54f2a657ca6e61ba4 |
|
BLAKE2b-256 | e0eaa446f6ff5809bd965c07a0e9b1ebcae80b9b1ff446fc8b8639d8caea583b |
File details
Details for the file fakebigtable-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: fakebigtable-0.1.3-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ee71096463fa6008574257daf7938aca9828768b062fce8ba12c47b5d01d92c |
|
MD5 | e6c04619d0629c5641b50cc93aa98794 |
|
BLAKE2b-256 | f6f633e9f0c332c8de1c7fad31bc50a4e1cc56b78df390d086b0fbfd55cd129f |