{"id":13647327,"url":"https://github.com/ansible-community/pytest-molecule","last_synced_at":"2025-09-29T10:30:40.550Z","repository":{"id":39620297,"uuid":"192503917","full_name":"ansible-community/pytest-molecule","owner":"ansible-community","description":"Please switch to pytest-ansible","archived":true,"fork":false,"pushed_at":"2023-09-14T18:50:22.000Z","size":180,"stargazers_count":23,"open_issues_count":0,"forks_count":10,"subscribers_count":8,"default_branch":"main","last_synced_at":"2024-05-21T07:07:13.767Z","etag":null,"topics":["ansible","ansible-devtools","molecule","pytest","pytest-plugin"],"latest_commit_sha":null,"homepage":"https://github.com/ansible-community/pytest-ansible","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ansible-community.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"ssbarnea"}},"created_at":"2019-06-18T08:59:54.000Z","updated_at":"2024-06-14T16:20:53.906Z","dependencies_parsed_at":"2024-06-14T16:20:52.614Z","dependency_job_id":"4b9ee043-9c8d-4d76-bd52-dcff6b4910c4","html_url":"https://github.com/ansible-community/pytest-molecule","commit_stats":{"total_commits":142,"total_committers":11,"mean_commits":"12.909090909090908","dds":"0.35915492957746475","last_synced_commit":"159c9423f7e3d15f1e5d1f13f45946c2daa40637"},"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ansible-community%2Fpytest-molecule","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ansible-community%2Fpytest-molecule/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ansible-community%2Fpytest-molecule/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ansible-community%2Fpytest-molecule/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ansible-community","download_url":"https://codeload.github.com/ansible-community/pytest-molecule/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234609320,"owners_count":18859849,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","ansible-devtools","molecule","pytest","pytest-plugin"],"created_at":"2024-08-02T01:03:29.688Z","updated_at":"2025-09-29T10:30:35.235Z","avatar_url":"https://github.com/ansible-community.png","language":"Python","funding_links":["https://github.com/sponsors/ssbarnea"],"categories":["Python"],"sub_categories":[],"readme":"===============\nNotice\n===============\n\nThe functionality provided by this plugin has been merged into the pytest-ansible_ plugin.\n\nPlease switch to `pytest-ansible` for future updates.\n\n\n===============\npytest-molecule\n===============\n\n.. image:: https://img.shields.io/pypi/v/pytest-molecule.svg\n    :target: https://pypi.org/project/pytest-molecule\n    :alt: PyPI version\n\n.. image:: https://img.shields.io/pypi/pyversions/pytest-molecule.svg\n    :target: https://pypi.org/project/pytest-molecule\n    :alt: Python versions\n\n.. image:: https://zuul-ci.org/gated.svg\n    :target: https://dashboard.zuul.ansible.com/t/ansible/builds?project=pycontribs/selinux\n    :alt: See Build Status on Zuul CI\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n    :target: https://github.com/python/black\n    :alt: Python Black Code Style\n\nPyTest Molecule Plugin :: auto detects and runs molecule tests\n\n----\n\nThis plugin enables pytest discovery of all ``molecule.yml`` files inside the\ncodebase and runs them as pytest tests.\n\nOnce you install pytest-molecule you should be able to just run ``pytest`` in\norder to run molecule on all roles and scenarios.\n\nOptionally you can define ``MOLECULE_OPTS`` for passing extra parameters to\neach molecule call.\n\nDiscovered tests do have molecule ``driver`` and ``platforms`` added as\nmarkers_, so you can selectively limit which test types to run:\n\n.. code-block:: shell\n\n    # Lists all tests that uses docker\n    $ pytest --collect-only -m docker\n\n    # Runs scenarios with platform named centos7 and delegated driver:\n    $ pytest -m delegated -m centos7\n\nIf the molecule scenario does not contain information about the driver, the\ntest associated with it gets a ``no_driver`` mark.\n\nPlease note that at this moment molecule will run the entire scenario if the\nmarkers are platforms, this is not *yet* a way to limit which platforms are\nexecuted inside a specific scenario.\n\nAll tests are added the ``molecule`` marker.\n\nThis plugin also adds a new pytest option named\n``--molecule-unavailable-driver=skip`` which can be used to tell it what to do\nwhen molecule drivers are not loading. Current default is ``None`` but you\ncan choose marks like ``skip`` or ``xfail``.\n\nThe plugin adds ``--skip-no-git-change`` option which an be used to skip tests\non unchanged roles according to ``git diff`` result and thus can only be used\nonly when running pytest inside a git repository. It takes one argument and old\nrefspec used as a reference. For instance calling:\n``pytest --skip-no-git-change HEAD^`` will result in molecule of roles that\nweren't changed in the last commit being skipped.\n\n\nUsing xfail and skip markers\n----------------------------\n\nIf you need to skip or ignore a particular scenario, just add either ``xfail``\nor ``skip`` to markers list inside its config file.\n\n.. code-block:: yaml\n\n    markers:\n      - xfail  # broken scenario, pytest will run it but ignore the result\n\nInstallation\n------------\n\nYou can install \"pytest-molecule\" via pip_ from PyPI_:\n\n.. code-block:: shell\n\n    $ PIP_NO_BUILD_ISOLATION=false pip install pytest-molecule\n\n``PIP_NO_BUILD_ISOLATION`` is needed only on ancient python distributions to\nworkaround https://github.com/pypa/pip/issues/5229\n\nContributing\n------------\nContributions are very welcome. Tests can be run with tox_, please ensure\nthe coverage at least stays the same before you submit a pull request.\n\nLicense\n-------\n\nDistributed under the terms of the MIT_ license, \"pytest-molecule\" is free\nand open source software\n\n\nIssues\n------\n\nIf you encounter any problems, please `file an issue`_ along with a detailed\ndescription.\n\n.. _`MIT`: http://opensource.org/licenses/MIT\n.. _`file an issue`: https://github.com/pycontribs/pytest-molecule/issues\n.. _`pytest`: https://github.com/pytest-dev/pytest\n.. _`tox`: https://tox.readthedocs.io/en/latest/\n.. _`pip`: https://pypi.org/project/pip/\n.. _`PyPI`: https://pypi.org/project\n.. _markers: http://doc.pytest.org/en/latest/example/markers.html\n.. _pytest-ansible: https://github.com/ansible-community/pytest-ansible\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fansible-community%2Fpytest-molecule","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fansible-community%2Fpytest-molecule","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fansible-community%2Fpytest-molecule/lists"}