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.
Installation
This tool requires you to have a copy of the fake-gcs-server binary somewhere on your path.
Depending upon your architecture you'll need a different version of the tool.
wget https://github.com/fsouza/fake-gcs-server/releases/download/v1.47.8/fake-gcs-server_1.47.8_Linux_amd64.tar.gz
tar -xvf fake-gcs-server_1.47.8_Linux_amd64.tar.gz
mv fake-gcs-server /usr/local/bin
To install this library:
pip install pytest-gcs
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.
Metadata
Release files for pytest-gcs 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pytest_gcs-0.1.0.tar.gz | 9.4 kB | Without provenance | Details for pytest_gcs-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pytest_gcs-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for pytest_gcs-0.1.0-py3-none-any.whl |
Total release size: 18.9 kB
Release files / pytest_gcs-0.1.0.tar.gz
| Download URL | pytest_gcs-0.1.0.tar.gz |
|---|---|
| Size | 9.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eabe6066b2352e672516a177b67ce9e5d573b4affc154b63bd74eefcacacbf78
|
|
BLAKE2b-256 checksum How to use checksums |
e6f12ba9a30187854d847a324e914429ee0ab90898b74b0d7ff562be599dccc5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.21
|
Release files / pytest_gcs-0.1.0-py3-none-any.whl
| Download URL | pytest_gcs-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b32929c5ff8c554dd4cc39cb5df3a8cf07ecf87592b6e2d8747f9d202cef9532
|
|
BLAKE2b-256 checksum How to use checksums |
7838336db30bcbd4e8c5dddb665040c00c6a389da65315dcf16ea07518c165d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.21
|
Security for pytest-gcs 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.