Metadata-Version: 2.1
Name: pytest-copie
Version: 0.1.3
Summary: The pytest plugin for your Copier templates.
Author-email: Pierrick Rambaud <pierrick.rambaud49@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/12rambau/pytest-copie
Keywords: Python,pytest,pytest-plugin,copier
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Python: >=3.8
Description-Content-Type: text/x-rst
Requires-Dist: deprecated>=1.2.14
Requires-Dist: copier
Requires-Dist: pytest
Provides-Extra: dev
Requires-Dist: pre-commit; extra == "dev"
Requires-Dist: commitizen; extra == "dev"
Requires-Dist: nox; extra == "dev"
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Requires-Dist: coverage; extra == "test"
Requires-Dist: pytest-sugar; extra == "test"
Requires-Dist: pytest-deadfixtures; extra == "test"
Provides-Extra: doc
Requires-Dist: sphinx>=6.2.1; extra == "doc"
Requires-Dist: sphinx-immaterial; extra == "doc"
Requires-Dist: sphinx-copybutton; extra == "doc"
Requires-Dist: sphinx-autoapi; extra == "doc"
Requires-Dist: sphinxemoji; extra == "doc"


pytest-copie
============

.. image:: https://img.shields.io/badge/License-MIT-yellow.svg?logo=opensourceinitiative&logoColor=white
    :target: LICENSE
    :alt: License: MIT

.. image:: https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg?logo=git&logoColor=white
   :target: https://conventionalcommits.org
   :alt: conventional commit

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
   :target: https://github.com/psf/black
   :alt: Black badge

.. image:: https://img.shields.io/badge/code_style-prettier-ff69b4.svg?logo=prettier&logoColor=white
   :target: https://github.com/prettier/prettier
   :alt: prettier badge

.. image:: https://img.shields.io/badge/pre--commit-active-yellow?logo=pre-commit&logoColor=white
    :target: https://pre-commit.com/
    :alt: pre-commit

.. image:: https://img.shields.io/pypi/v/pytest-copie?color=blue&logo=pypi&logoColor=white
    :target: https://pypi.org/project/pytest-copie/
    :alt: PyPI version

.. image:: https://img.shields.io/github/actions/workflow/status/12rambau/pytest-copie/unit.yaml?logo=github&logoColor=white
    :target: https://github.com/12rambau/pytest-copie/actions/workflows/unit.yaml
    :alt: build

.. image:: https://img.shields.io/codecov/c/github/12rambau/pytest-copie?logo=codecov&logoColor=white
    :target: https://codecov.io/gh/12rambau/pytest-copie
    :alt: Test Coverage

.. image:: https://img.shields.io/readthedocs/pytest-copie?logo=readthedocs&logoColor=white
    :target: https://pytest-copie.readthedocs.io/en/latest/
    :alt: Documentation Status

Overview
--------

pytest-copie is a `pytest <https://github.com/pytest-dev/pytest>`__ plugin that comes with a ``copie`` fixture which is a wrapper on top the `copier <https://github.com/copier-org/copier>`__ API for generating projects. It helps you verify that your template is working as expected and takes care of cleaning up after running the tests. :ledger:

It is an adaptation of the `pytest-cookies <https://github.com/hackebrot/pytest-cookies>`__ plugin for `copier <https://github.com/copier-org/copier>`__ templates.

It’s here to help templates designers to check that everything works as expected on the generated files including (but not limited to):

-   linting operations
-   testing operations
-   packaging operations
-   documentation operations
-   …

Installation
------------

**pytest-copie** is available on `PyPI <https://pypi.org/project/pytest-copie/>`__ and can be installed with `pip <https://pip.pypa.io/en/stable/>`__:

.. code-block:: console

    pip install pytest-copie

Usage
-----

The ``copie`` fixture will allow you to ``copy`` a template and run tests against it. It will also clean up the generated project after the tests have been run.

.. code-block:: python

    def test_template(copie):
        res = copie.copy(extra_answers={"repo_name": "helloworld"})

        assert res.exit_code == 0
        assert res.exception is None
        assert result.project_dir.name == "helloworld"
        assert result.project_dir.is_dir()

Context and template location can be fully customized, see our `documentation <https://pytest-copie.readthedocs.io>`__ for more details.
