pytest-jubilant-bdd
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: Agivenstep handler for adding one or more machines to a Juju model.add_model: Agivenstep handler for adding a new Juju model to the testing context.add_storage: Agivenstep handler for adding storage to a deployed unit, with optional storage pool, size, and count clauses.add_unit: Agivenstep handler for adding units to a deployed application.deploy: Agivenstep handler for deploying a charm from Charmhub.deploy_local: Agivenstep handler for deploying a local.charmfile onto a Juju model.disintegrate: Agivenstep handler for removing the integration between two Juju applications.integrate: Agivenstep handler for integrating two Juju applications.model_exists: Agivenstep handler for asserting that a Juju model currently exists.pack_charm: Agivenstep handler for packing a charm from a project directory usingcharmcraft. Skips packing when the<APP>_CHARM_PATHenvironment variable is already set.remove_unit: Agivenstep handler for removing one or more units from a deployed application.remove_storage: Agivenstep handler for removing one or more storage instances from a Juju model.is_app_config_set: Agivenstep handler for verifying that a configuration option on a deployed application is set to a value.is_integrated: Agivenstep handler for asserting that two applications are currently integrated.is_deployed: Agivenstep handler for asserting that an application is currently deployed on a Juju model.reset_app_config: Agivenstep handler for resetting a configuration option on a deployed application to its default.reset_model_config: Agivenstep handler for resetting a model configuration option to its default.set_app_config: Agivenstep handler for setting a configuration option on a deployed application.set_model_config: Agivenstep handler for setting a configuration option on a Juju model.switch_model: Agivenstep handler for switching the default model that subsequent step handlers operate on.run_action: Awhenstep handler for running a Juju action on one or more units.run_exec: Awhenstep handler for executing a command on one or more machines or units.run_ssh: Awhenstep handler for SSHing into a machine or unit and executing a command.assert_all_agent_status: A checkpoint step handler for asserting the status of all agents in one or more models, with an optionalwithin '{timeout}' secondsclause to override the global--juju-bdd-wait-timeout.assert_storage_attached: A checkpoint step handler for asserting that a number of storage instances are attached to a unit, with an optionalwithin '{timeout}' secondsclause to override the global--juju-bdd-wait-timeout.assert_workload_status: A checkpoint step handler for asserting the workload status of a deployed application, with an optionalwithin '{timeout}' secondsclause to override the global--juju-bdd-wait-timeout.assert_workload_status_message: A checkpoint step handler for asserting the message attached to a workload status, with an optionalwithin '{timeout}' secondsclause to override the global--juju-bdd-wait-timeout.
Checkpoint assertions are registered for given, when, and then steps
alike, so they can be used as checkpoints in any stanza of a scenario through
the And/But conjunctions. For example, Given I deploy 'slurmctld'
followed by And all agents are 'idle' waits for the deployment to settle
before proceeding to the next step.
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.13.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pytest_jubilant_bdd-0.13.0.tar.gz | 75.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_jubilant_bdd-0.13.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 101.0 kB
Release files / pytest_jubilant_bdd-0.13.0.tar.gz
| Download URL | pytest_jubilant_bdd-0.13.0.tar.gz |
|---|---|
| Size | 75.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b07324bb3c3e7b3ef01e7459255c5d49fbb3508b9befe86910c5a4f60f44594f
|
|
BLAKE2b-256 checksum How to use checksums |
fd4ddfaee55479f3e3e83bd9979e88fd35d93abe4c27613c776388a159c027df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","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.13.0-py3-none-any.whl
| Download URL | pytest_jubilant_bdd-0.13.0-py3-none-any.whl |
|---|---|
| Size | 25.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dbb4b3d8ddc09f00978eb8e013b6a1de397f2c1ebbb84acac16756a60538649b
|
|
BLAKE2b-256 checksum How to use checksums |
9921fb21b7e6824f5b376e3ddcd9cb2ffb1a7b6e26942cda2ae6a06459a5c78c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","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}
|