Skip to main content

PyTest Molecule Plugin :: discover and run molecule tests

Project description

PyPI version Python versions See Build Status on Zuul CI Python Black Code Style

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

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest-molecule-1.3.0a0.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

pytest_molecule-1.3.0a0-py2.py3-none-any.whl (6.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pytest-molecule-1.3.0a0.tar.gz.

File metadata

  • Download URL: pytest-molecule-1.3.0a0.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.2

File hashes

Hashes for pytest-molecule-1.3.0a0.tar.gz
Algorithm Hash digest
SHA256 b23cb5ac7cc25b2343fea869f8a8be331ef3785e65feb9294103e39291eb9d93
MD5 ee85b5c6c251c3f53b0b95b4cb27be15
BLAKE2b-256 d4114d79d2fcd3b413f2952fc47c9551b9687f28a6ccf7fd49711d20e9246c7d

See more details on using hashes here.

File details

Details for the file pytest_molecule-1.3.0a0-py2.py3-none-any.whl.

File metadata

  • Download URL: pytest_molecule-1.3.0a0-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.2

File hashes

Hashes for pytest_molecule-1.3.0a0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f68cf4dfbb8ee561958953d20f9b7f3d3e61043c0cffe297dac87b36cc877cfe
MD5 bcc45844ca83308ad27d7970fdae1b62
BLAKE2b-256 4ae9adff059ffc43352fa2e490f015f58e08f2386db6b4668b09d729de692f18

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page