Skip to main content
New to Testkube? Unleash the power of cloud native testing in Kubernetes with Testkube. Get Started >

Pytest

warning

Features described in this document are being deprecated as part of the transition to Test Workflows - Read More.

This is a simple python based executor for pytest framework https://docs.pytest.org/ You can run pytest with Testkube to use it in your automated tests for your Kubernetes clusters.

Usage

Before starting, please switch your current folder to /contrib/container/pytest

Step 1 - Add the executor to Testkube.

`kubectl apply -f container-executor-pytest.yaml`

Step 2 - Build the executor Docker image.

Current Docker image is based on Python 3.8.17 and a few basic modules, like pipenv, pytest and requests. Feel free to change the python version, install missing dependencies, etc. Docker image should be placed in your favourite docker image registry, like local Docker image registry for Minikube, Kind, etc or Cloud provider one.

docker build -t pytest-executor -f Dockerfile

Step 3 - Create a test.

kubectl apply -f pytest_test.yaml

And now run the tests to see failed and passed results.

`kubectl testkube run test container-executor-pytest-failed-sample`
`kubectl testkube run test container-executor-pytest-passed-sample`