Skip to main content

pytest-helm-charts

build codecov Documentation Status PyPI Version Python Versions Apache License

A plugin to test helm charts on Kubernetes clusters.

Full documentation (including API) available on https://pytest-helm-charts.readthedocs.io/.


Features

This plugin provides a set of pytest fixtures that allow you to easily write tests for Helm charts and run them on Kubernetes clusters.

It can be also used to test Helm charts deployed using the Open Source Giant Swarm App Platform.

Most important features:

  • provides pykube-ng interface to access Kubernetes clusters
  • provides environment variables based options to configure the target cluster to run on
  • provides fixtures to work with some standard Kubernetes resources as well as some custom ones:
    • [Kubernetes objects](::: pytest_helm_charts.k8s)
    • [Giant Swarm App Platform objects](::: pytest_helm_charts.giantswarm_app_platform)
    • [Flux CD objects](::: pytest_helm_charts.flux)
  • provides set of fixtures to easily work with Helm charts

Requirements

Please check [project.dependencies] list in the pyproject.toml file.

Installation

You can install "pytest-helm-charts" via pip from PyPI:

pip install pytest-helm-charts

Usage

Running your tests

When you want to run your tests, you invoke pytest as usual, just configuring cluster and chart information using environment variables or command line options. The following options are available as environment variables (start pytest with -h to check corresponding command line options):

  • "KUBECONFIG" - (mandatory) a path to kube config file used to connect to a k8s cluster
  • "ATS_CHART_PATH" - path to a chart being tested (if a chart is tested)
  • "ATS_CHART_VERSION" - version of the chart being tested (if a chart is tested)
  • "ATS_CLUSTER_TYPE" - type of the cluster used for testing
  • "ATS_CLUSTER_VERSION" - k8s version of the cluster used for testing
  • "ATS_APP_CONFIG_FILE_PATH" - optional path to a values.yaml file used to configure a chart under test (if a chart is tested)
  • "ATSEXTRA*" - any such arbitrary variable value will be extracted and included in the test_extra_info fixture

Currently, the only supported cluster type is external, which means the cluster is not managed by the test suite. You just point the test suite to a kube.config file, which can be used to connect to the Kubernetes API with KUBECONFIG env variable option. For creating development time clusters, we recommend using KinD.

If you use this project to test Helm charts against Giant Swarm App Platform, the existing cluster must already have the platform components installed. Please refer to and use the app-test-suite tool to easily create KinD based clusters with all the components already installed.

Writing tests

The easiest way to get started is by checking our examples.

The list of available fixtures can be found by running pytest --fixtures, but you can also just check the most important fixtures.

Full API docs are also available.

Contributing

Contributions are very welcome.

  • Project is managed with uv, to start developing run uv sync
  • Tests for all supported python versions can be run with tox: tox -- --log-cli-level info tests/
  • Please ensure the coverage at least stays the same before you submit a pull request.

Creating a new release

  • merge your changes to master branch
  • edit pyproject.toml and update the project version; edit CHANGELOG.md; commit
  • create a new tag with the same version in git, i.e. git tag v1.1.1
  • push your changes to GitHub to trigger a release git push; git push origin v1.1.1

License

See LICENSE.

Changelog

See CHANGELOG.md.

Issues

If you encounter any problems, please file an issue along with a detailed description.

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_charts-1.3.5.tar.gz (31.6 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_charts-1.3.5-py3-none-any.whl (50.7 kB view details)

Uploaded Python 3

File details

Details for the file pytest_helm_charts-1.3.5.tar.gz.

File metadata

  • Download URL: pytest_helm_charts-1.3.5.tar.gz
  • Upload date:
  • Size: 31.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.12 {"installer":{"name":"uv","version":"0.12.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pytest_helm_charts-1.3.5.tar.gz
Algorithm Hash digest
SHA256 977ca141a09763de84f018236dcbd2c8b533c7adde97898b8c2a19537b44c872
MD5 63ce49dbbea77a0abc0e2feeab262788
BLAKE2b-256 7b236a6cad43c09219fbd727be1da619d4c4df07a59968e4879603d7308f43d7

See more details on using hashes here.

File details

Details for the file pytest_helm_charts-1.3.5-py3-none-any.whl.

File metadata

  • Download URL: pytest_helm_charts-1.3.5-py3-none-any.whl
  • Upload date:
  • Size: 50.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.12 {"installer":{"name":"uv","version":"0.12.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pytest_helm_charts-1.3.5-py3-none-any.whl
Algorithm Hash digest
SHA256 e5b3db4418dc9560fc01c19b81b8e34bb8c5d749eaebf2fa9cb7dc3ec952300c
MD5 3a7e80f39cdaebecbb8c16785ead8ba0
BLAKE2b-256 621217e1b4fb9598b97d96b90de155725b67615c946717d2f5a396cdb7c7240b

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.3.5 This release

2 files

1.3.4

2 files

1.3.2

2 files

1.3.1

2 files

1.2.0

2 files

1.1.2

2 files

1.1.1

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

0.7.1

2 files

0.7.0

2 files

0.6.0

2 files

0.5.3

2 files

0.5.2

2 files

0.5.1

2 files

0.5.0

2 files

0.4.1

2 files

0.4.0

2 files

0.3.2

2 files

0.3.1

2 files

0.2.1

2 files

0.1.10

2 files

0.1.9

2 files

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page