Skip to main content

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

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest_google_cloud_storage-1.1.0.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_google_cloud_storage-1.1.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file pytest_google_cloud_storage-1.1.0.tar.gz.

File metadata

File hashes

Hashes for pytest_google_cloud_storage-1.1.0.tar.gz
Algorithm Hash digest
SHA256 fb0115e741e7e5f2261342841935137a9c8aace36751096414a70d17cd71aa9f
MD5 92747e7d290c88d8553cd97ea99ae9f2
BLAKE2b-256 5d3ff81613b17c9331dd923c1d169e0460a12479f69bf84e7d3890d6838d6814

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_google_cloud_storage-1.1.0.tar.gz:

Publisher: pypi-push.yaml on Jankovn/pytest-google-cloud-storage

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytest_google_cloud_storage-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_google_cloud_storage-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8ae620a93ba8e56a741f2d86a033c959b01905df9db359bcc300a0836ace522c
MD5 e6b6a3eb2235cbbef65b65e149a883be
BLAKE2b-256 32a35832e612a974490846eb5c6c400348dcf1b15a00b9e25b0190cf07353bf8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_google_cloud_storage-1.1.0-py3-none-any.whl:

Publisher: pypi-push.yaml on Jankovn/pytest-google-cloud-storage

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page