PyTest Molecule Plugin :: discover and run molecule tests
Project description
PyTest Molecule Plugin :: auto detects and runs molecule tests
This plugin enables pytest discovery of all molecule.yml files inside the codebase and runs them as pytest tests.
Once you install pytest-molecule you should be able to just run pytest in order to run molecule on all roles and scenarios.
Optionally you can define MOLECULE_OPTS for passing extra parameters to each molecule call.
Discovered tests do have molecule driver and platforms added as markers, so you can selectively limit which test types to run:
# Lists all tests that uses docker
$ pytest --collect-only -m docker
# Runs scenarios with platform named centos7 and delegated driver:
$ pytest -m delegated -m centos7
If the molecule scenario does not contain information about the driver, the test associated with it gets a no_driver mark.
Please note that at this moment molecule will run the entire scenario if the markers are platforms, this is not yet a way to limit which platforms are executed inside a specific scenario.
All tests are added the molecule marker.
This plugin also adds a new pytest option named --molecule-unavailable-driver=skip which can be used to tell it what to do when molecule drivers are not loading. Current default is None but you can choose marks like skip or xfail.
Installation
You can install “pytest-molecule” via pip from PyPI:
$ PIP_NO_BUILD_ISOLATION=false pip install pytest-molecule
PIP_NO_BUILD_ISOLATION is needed only on ancient python distributions to workaround https://github.com/pypa/pip/issues/5229
Contributing
Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.
License
Distributed under the terms of the MIT license, “pytest-molecule” is free and open source software
Issues
If you encounter any problems, please file an issue along with a detailed description.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pytest-molecule-1.3.4.tar.gz
.
File metadata
- Download URL: pytest-molecule-1.3.4.tar.gz
- Upload date:
- Size: 16.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 846323a5dffba4723e8b835e546960685417bd14ac7a4b79b86bd2403e0e9f29 |
|
MD5 | f46a05a10a9f54b456fb87a0709c0f35 |
|
BLAKE2b-256 | 5962eea5938e1edca4663290305fe1f5a564d708c540c3fb38012be9c6e27573 |
File details
Details for the file pytest_molecule-1.3.4-py2.py3-none-any.whl
.
File metadata
- Download URL: pytest_molecule-1.3.4-py2.py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27688f56392562a11497c1c07eec4267499ad2e681c722b6ff8f6e76a49b3617 |
|
MD5 | 578e230c053ec09ea2e336688f5888a1 |
|
BLAKE2b-256 | c4b18cdb4450bfc0b992618638790df41c05c4c20337595ea72c79556e5d0f1c |