Skip to main content

pytest-jubilant-bdd

GitHub License Matrix

A pytest plugin providing reusable Gherkin step handlers for behavior-driven testing of Juju charmed operators.

pytest-jubilant-bdd is a collection of various utilities that make it easier for you and your friends to write behavior-driven tests for Juju charmed operators. The plugin provides a curated set of reusable Gherkin step handlers built on top of jubilant and pytest-bdd, so you can focus on the behavior of your charms instead of the boilerplate of driving the Juju lifecycle from your tests. Current reusable steps shipped in the pytest-jubilant-bdd package include:

  • add_machine: A given step handler for adding one or more machines to a Juju model.
  • add_model: A given step handler for adding a new Juju model to the testing context.
  • add_storage: A given step handler for adding storage to a deployed unit, with optional storage pool, size, and count clauses.
  • add_unit: A given step handler for adding units to a deployed application.
  • deploy: A given step handler for deploying a charm from Charmhub.
  • deploy_local: A given step handler for deploying a local .charm file onto a Juju model.
  • integrate: A given step handler for integrating two Juju applications.
  • model_exists: A given step handler for asserting that a Juju model currently exists.
  • pack_charm: A given step handler for packing a charm from a project directory using charmcraft. Skips packing when the <APP>_CHARM_PATH environment variable is already set.
  • remove_unit: A given step handler for removing one or more units from a deployed application.
  • remove_storage: A given step handler for removing one or more storage instances from a Juju model.
  • is_app_config_set: A given step handler for verifying that a configuration option on a deployed application is set to a value.
  • is_integrated: A given step handler for asserting that two applications are currently integrated.
  • is_deployed: A given step handler for asserting that an application is currently deployed on a Juju model.
  • reset_app_config: A given step handler for resetting a configuration option on a deployed application to its default.
  • reset_model_config: A given step handler for resetting a model configuration option to its default.
  • set_app_config: A given step handler for setting a configuration option on a deployed application.
  • set_model_config: A given step handler for setting a configuration option on a Juju model.
  • switch_model: A given step handler for switching the default model that subsequent step handlers operate on.
  • run_action: A when step handler for running a Juju action on one or more units.
  • run_exec: A when step handler for executing a command on one or more machines or units.
  • run_ssh: A when step handler for SSHing into a machine or unit and executing a command.
  • assert_all_agent_status: A then step handler for asserting the status of all agents in one or more models, with an optional within '{timeout}' seconds clause to override the global --juju-bdd-wait-timeout.
  • assert_storage_attached: A then step handler for asserting that a number of storage instances are attached to a unit, with an optional within '{timeout}' seconds clause to override the global --juju-bdd-wait-timeout.
  • assert_workload_status: A then step handler for asserting the workload status of a deployed application, with an optional within '{timeout}' seconds clause to override the global --juju-bdd-wait-timeout.
  • assert_workload_status_message: A then step handler for asserting the message attached to a workload status, with an optional within '{timeout}' seconds clause to override the global --juju-bdd-wait-timeout.

For more information on how to use or contribute to pytest-jubilant-bdd, check out the Development section below 👇

🤔 What's next?

If you want to learn more about all the things you can do with pytest-jubilant-bdd, here are some further resources for you to explore:

🛠️ Development

The project uses just and uv for development, which provides some useful commands that will help you while hacking on pytest-jubilant-bdd:

just fmt          # Apply formatting standards to code
just lint         # Check code against coding style standards
just typecheck    # Run static type checks
just unit         # Run unit tests

If you're interested in contributing your work to pytest-jubilant-bdd, take a look at our contributing guidelines for further details.

🤝 Project and community

pytest-jubilant-bdd is a project of the Ubuntu High-Performance Computing community. Interested in contributing bug fixes, new step handlers, documentation, or feedback? Want to join the Ubuntu HPC community? You’ve come to the right place 🤩

Here’s some links to help you get started with joining the community:

📋 License

pytest-jubilant-bdd is free software, distributed under the Apache License, v2.0. See the LICENSE file for further details.

Release files for pytest-jubilant-bdd 0.12.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-jubilant-bdd 0.12.0
File Size Uploaded
pytest_jubilant_bdd-0.12.0.tar.gz 22.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-jubilant-bdd 0.12.0
File Interpreter ABI Platform
pytest_jubilant_bdd-0.12.0-py3-none-any.whl Python 3 none any Details

Total release size: 48.6 kB

Release files / pytest_jubilant_bdd-0.12.0.tar.gz

Download URL pytest_jubilant_bdd-0.12.0.tar.gz
Size 22.9 kB
Tags Source
SHA-256 checksum
How to use checksums
740a3bf2be42d2caa0ed13163224d4d34700c3da95fe83d1dd9bae834c3301d2
BLAKE2b-256 checksum
How to use checksums
f32fb43976f1fec72aebb3ae750eb17876777fba7e949ebd6d4608f9cb3fc9cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.6 {"installer":{"name":"uv","version":"0.12.6","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}

Release files / pytest_jubilant_bdd-0.12.0-py3-none-any.whl

Download URL pytest_jubilant_bdd-0.12.0-py3-none-any.whl
Size 25.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7c0e3f3e55f1f14b98e43ee135b9704bbe3cabe05172a5f74fff8c2711ad8fc6
BLAKE2b-256 checksum
How to use checksums
39c9d0691d9c0c1ac27f02954e4c6290202c2a9f65a5a6510570fc7d30e537f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.6 {"installer":{"name":"uv","version":"0.12.6","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}

Release history Release notifications | RSS feed

0.15.0

2 release files

0.14.0

2 release files

0.13.0

2 release files

This release

0.12.0 This release

2 release files

0.11.0

2 release files

0.10.0

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release 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