GCS fixtures and fixture factories for Pytest.
Project description
Pytest GCS
This is a pytest plugin in similar vein to pytest-postgres and pytest-kafka.
This would have been much more painful without Mirakuru and fake-gcs-server; this is a simple wrapper around those tools.
Setup
This tool requires you to have a copy of the fake-gcs-server
binary somewhere on your path.
Demo
# conftest.py
from pytest_gcs.factories import client as gcs_client
from pytest_gcs.factories import proc as gcs_process
# Create a process and a local client that targets that process.
gcs_proc = gcs_process.gcs_proc()
gcslocal = gcs_client.gcslocal("gcs_proc")
# tests/test_gcs.py
from google.cloud import storage
from pytest_gcs.executor.process import GCSExecutor
def test_can_create_gcs_bucket(gcs_proc: GCSExecutor, gcslocal: storage.Client) -> None:
"""MVP to ensure everything works."""
bucket = "test_base"
gcslocal.create_bucket(bucket)
buckets = [x.name for x in gcslocal.list_buckets()]
assert bucket in buckets
Contributing
PRs are accepted.
# Install the dependencies with:
pip install .[test]
# Install pre-commit hooks.
pre-commit install
# Validate everything passes.
pre-commit run --all
# Run the tests.
pytest tests/
TODOs
- Implement the events outputs,
-event.bucket
,-event.list
, etc.
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
pytest-gcs-0.0.1.tar.gz
(8.3 kB
view hashes)
Built Distribution
Close
Hashes for pytest_gcs-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1220417359ab0ad7126291482c2d6378c85e3ca0f7a4717aabbee71663a40e32 |
|
MD5 | 4709f61c3727f0d3ac3170798cd20bf2 |
|
BLAKE2b-256 | 24dde00ea7ada90c7a062bdc1fe761f250e60fe7a6c8b858c8aeaad3b337b131 |