An in-memory stub implementation of Google Cloud Datastore for use in unit tests
Project description
An In-Memory Stub for Google Cloud Datastore
This project is a pure python implementation of the Google Cloud Datastore RPC Spec. This allows projects using the python-ndb lirary to write unit tests without needing to depend on/manage the full datastore emulator.
Installing
InMemoryCloudDatatoreStub
can be installed from PyPi:
$ pip install InMemoryCloudDatastoreStub
Using
The stub can be inserted into your unit tests as a pytest fixture using monkeypatch:
from unittest.mock import magicMock
import pytest
from InMemoryCloudDatastoreStub.datastore_stub import LocalDatastoreStub
@pytest.fixture()
def ndb_stub(monkeypatch):
stub = LocalDatastoreStub()
monkeypatch.setattr(_datastore_api, "stub", MagicMock(return_value=stub))
return stub
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for InMemoryCloudDatastoreStub-0.0.15.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ee24d86795749b020e827565bcbbbac60c3774ec5bcb351b6c4dfcd4061edb1 |
|
MD5 | 3fe4fb5dcdf5884755ce7fe0b095dbf4 |
|
BLAKE2b-256 | dba2e9fd99c853154ee0688d17be3e7cb53fc8958ff08fc21d40b5c80d7f68fe |
Close
Hashes for InMemoryCloudDatastoreStub-0.0.15-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b92b687fb2d4605cec5b63479e86fbd6697576950bad4469c696b2532cb04864 |
|
MD5 | d2971e892d8b2efddc0106fe1f9f9647 |
|
BLAKE2b-256 | 9ab9300dd528e97a4378e3b17683f4f519a92da592bedf8f84c2a66ee92dd06c |