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
File details
Details for the file InMemoryCloudDatastoreStub-0.0.15.tar.gz
.
File metadata
- Download URL: InMemoryCloudDatastoreStub-0.0.15.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ee24d86795749b020e827565bcbbbac60c3774ec5bcb351b6c4dfcd4061edb1 |
|
MD5 | 3fe4fb5dcdf5884755ce7fe0b095dbf4 |
|
BLAKE2b-256 | dba2e9fd99c853154ee0688d17be3e7cb53fc8958ff08fc21d40b5c80d7f68fe |
File details
Details for the file InMemoryCloudDatastoreStub-0.0.15-py3-none-any.whl
.
File metadata
- Download URL: InMemoryCloudDatastoreStub-0.0.15-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b92b687fb2d4605cec5b63479e86fbd6697576950bad4469c696b2532cb04864 |
|
MD5 | d2971e892d8b2efddc0106fe1f9f9647 |
|
BLAKE2b-256 | 9ab9300dd528e97a4378e3b17683f4f519a92da592bedf8f84c2a66ee92dd06c |