Pytest custom features, e.g. fixtures and various tests. Aimed to emulate Google Cloud Storage service
Project description
Introduction
Pytest custom features, e.g. fixtures and various tests. Aimed to emulate Google Cloud Storage service
Requirements / Resources
- Docker
- fsouza/fake-gcs-server Emulates Google Cloud Storage
- Python >= 3.11
- Unix/MacOS environment
Usage
The project involves the development of a custom pytest plugin that emulates the Google Cloud Storage (GCS) service to support streamlined testing workflows.
It is built on top of the original docker image that handles natively google-cloud-storage functionality, with the project adding the necessary internal configuration to integrate seamlessly with Polars.
Originally designed to validate Polars DataFrame read/write operations in a simulated remote environment, the plugin enables efficient testing without relying on actual cloud infrastructure.
This setup allows for comprehensive integration testing that closely mirrors real-world cloud interactions.
Run the emulator manually
# If you intend to run the image without passing by pytest
docker run -v /tmp/data:/data -d -p 9023:9023 --name storage_emulator fsouza/fake-gcs-server -port 9023 -scheme http -backend memory -public-host 127.0.0.1:9023 -external-url http://127.0.0.1:9023 -filesystem-root /storage
The parameters are exactly the same as the docker command in the plugin.py file.
Linter
Ruff is the default Python linter used in the project.
If you want to check it, just run ruff check.
All ruff configuration are stored in the pyproject.toml file.
The check command can be added as a pre-commit hook
If by any mean you forget to check the syntax of your code before committing it,
the .pre-commit-config.yaml will call ruff check.
This avoids unnecessary commits that correct the fact that you forgot to apply the command.
# Install pre-commit
python3 -m pip install pre-commit
# Install ruff pre-commit in git correct path
python3 -m pre-commit install
How to test the plugin
Under the folder tests you'll find common and small tests used to give you the possibility and the usage you can have.
Appendix
Below, find attached
- Additional resources that helped building this plugin:
- Existing cloud storage emulator
- Github conversation
- Github code
- https://github.com/pola-rs/polars/blob/2db0ba608b223a014bba5e10d7b82505898798ed/docs/releases/upgrade/0.20.md?plain=1#L502
- https://docs.rs/object_store/0.12.0/object_store/gcp/struct.GoogleCloudStorageBuilder.html
- https://github.com/fsspec/gcsfs/blob/1543ab4fcc4b17fcaa680abab0e93fed33980e21/gcsfs/core.py#L161
- Similar services relying on other cloud provider
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytest_google_cloud_storage-1.1.1.tar.gz.
File metadata
- Download URL: pytest_google_cloud_storage-1.1.1.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2adec164694fdd77b59e0e7336dc333d518d82a7cfd6ae36091f373eb5a78515
|
|
| MD5 |
69e3463e074cb1512a696e25f2e235a8
|
|
| BLAKE2b-256 |
69bcfbf48e40297c7ce6ea8187846fa4af99100d2a7d950507d1fb0b9ea8c652
|
Provenance
The following attestation bundles were made for pytest_google_cloud_storage-1.1.1.tar.gz:
Publisher:
pypi-push.yaml on Jankovn/pytest-google-cloud-storage
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pytest_google_cloud_storage-1.1.1.tar.gz -
Subject digest:
2adec164694fdd77b59e0e7336dc333d518d82a7cfd6ae36091f373eb5a78515 - Sigstore transparency entry: 499324457
- Sigstore integration time:
-
Permalink:
Jankovn/pytest-google-cloud-storage@162776a3f12358ab057784fb9a033fc6897872f4 -
Branch / Tag:
refs/tags/1.1.1 - Owner: https://github.com/Jankovn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-push.yaml@162776a3f12358ab057784fb9a033fc6897872f4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pytest_google_cloud_storage-1.1.1-py3-none-any.whl.
File metadata
- Download URL: pytest_google_cloud_storage-1.1.1-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
040f4b2929f24886f5f939c90fff985c33b451792fa7d7960ce29f79a79d9d21
|
|
| MD5 |
12ea52dca7f39398f456ae4787e4a553
|
|
| BLAKE2b-256 |
361d11c7d2b00a57d8d65344abe2e278027996bece284f6af5c85eb65c853771
|
Provenance
The following attestation bundles were made for pytest_google_cloud_storage-1.1.1-py3-none-any.whl:
Publisher:
pypi-push.yaml on Jankovn/pytest-google-cloud-storage
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pytest_google_cloud_storage-1.1.1-py3-none-any.whl -
Subject digest:
040f4b2929f24886f5f939c90fff985c33b451792fa7d7960ce29f79a79d9d21 - Sigstore transparency entry: 499324517
- Sigstore integration time:
-
Permalink:
Jankovn/pytest-google-cloud-storage@162776a3f12358ab057784fb9a033fc6897872f4 -
Branch / Tag:
refs/tags/1.1.1 - Owner: https://github.com/Jankovn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-push.yaml@162776a3f12358ab057784fb9a033fc6897872f4 -
Trigger Event:
push
-
Statement type: