Skip to content

12rambau/pytest-copie

Folders and files

NameName
Last commit message
Last commit date

Latest commit

07bcad4 Β· Jan 31, 2025
Feb 5, 2024
Nov 18, 2024
Feb 5, 2024
Jan 31, 2025
Jan 31, 2025
Feb 5, 2024
Jun 25, 2024
Feb 5, 2024
Feb 5, 2024
Nov 14, 2023
Nov 14, 2023
Nov 14, 2023
Sep 5, 2023
Sep 5, 2023
Sep 5, 2023
Feb 5, 2024
Feb 5, 2024
Feb 5, 2024
Jan 31, 2025

Repository files navigation

pytest-copie

License: MIT conventional commit Black badge prettier badge pre-commit PyPI version Conda build Test Coverage Documentation Status

Overview

pytest-copie is a pytest plugin that comes with a copie fixture which is a wrapper on top the 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. πŸ“’

It is an adaptation of the pytest-cookies plugin for 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 and can be installed with pip:

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.

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.is_dir()

Context and template location can be fully customized, see our documentation for more details.

Credits

This package was created with Copier and the @12rambau/pypackage 0.1.11 project template.