Metadata-Version: 2.4
Name: pytest-helm
Version: 0.1.0
Summary: Simple, ergonomic Helm manifest fixtures for pytest.
Project-URL: Homepage, https://github.com/example/pytest-helm
Project-URL: Repository, https://github.com/example/pytest-helm
Project-URL: Issues, https://github.com/example/pytest-helm/issues
Author: pytest-helm contributors
License: MIT
Keywords: helm,kubernetes,pytest,testing
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: Pytest
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Testing
Requires-Python: >=3.10
Requires-Dist: pytest>=8.0.0
Requires-Dist: python-box>=7.1.1
Requires-Dist: ruamel-yaml>=0.18.0
Description-Content-Type: text/markdown

# 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:

```bash
uv add pytest-helm
```

Create `tests/conftest.py`:

```python
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:

```python
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

```python
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
)
```
