Skip to main content

Simple, ergonomic Helm manifest fixtures for pytest.

Project description

pytest-helm

pytest-helm makes Helm chart testing in pytest simple and repeatable.

It runs a helm template command, loads your manifest, and then allows you to make simple assertions about it's shape/contents.

Quickstart

Install:

uv add pytest-helm

Create tests/conftest.py:

from pytest_helm import manifest_fixture

default_manifest = manifest_fixture(
    "default_manifest",
    ["helm", "template", ".", "-f", "values.yaml"],
)

multi_tenant_manifest = manifest_fixture(
    "multi_tenant_manifest",
    ["helm", "template", ".", "-f", "multi-tenant-values.yaml"],
)

Write tests:

def test_it_works(default_manifest):
    cfg_map = default_manifest["ConfigMap"]["example-config"]
    assert cfg_map.data.AWS_DEFAULT_REGION == "us-east-2"


def test_it_works_for_multi_tenants(multi_tenant_manifest):
    cfg_map = multi_tenant_manifest["ConfigMap"]["example"]
    assert cfg_map.data.AWS_DEFAULT_REGION == "us-east-2"

Fixture Usage

manifest_fixture(
    name: str,                                               # The name of the fixture
    command: Sequence[str],                                  # Command list to render manifests
    *,
    on_duplicate: Literal["error", "overwrite"] = "error",   # Whether to raise an error on duplicate manifests
    scope: Literal["session"] = "session",                   # Currently session only, execute fixtures once per test sess
)

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_helm-0.1.0.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

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

pytest_helm-0.1.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file pytest_helm-0.1.0.tar.gz.

File metadata

  • Download URL: pytest_helm-0.1.0.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pytest_helm-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f6e74f22d66befce1eaa5c98bdf36c9e09d06cf4422264101f24a8092ae3df73
MD5 f3cfa7fb90f98ebf3718be3da9dfe277
BLAKE2b-256 6fb1fd9353625add5ab4605a39e6ec91123022134cfe67119befe3d1c0639883

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_helm-0.1.0.tar.gz:

Publisher: publish.yml on thomasv314/pytest-helm

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_helm-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pytest_helm-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pytest_helm-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cc8e7c8e891a23c5fa5e72ac20898d759d58090326564ef7daa8f745acef8a02
MD5 bb098285f8a508fc863a044d298b43bf
BLAKE2b-256 8f395930d49bc63eabc3b24a0ac0c86df57bbc3991c81d60ab61561ed80cbb77

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_helm-0.1.0-py3-none-any.whl:

Publisher: publish.yml on thomasv314/pytest-helm

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