Skip to main content

The pytest plugin for your Copier templates.

Project description

License: MIT conventional commit Black badge prettier badge pre-commit PyPI version 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. :ledger:

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.name == "helloworld"
    assert result.project_dir.is_dir()

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

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-copie-0.1.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

pytest_copie-0.1.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file pytest-copie-0.1.0.tar.gz.

File metadata

  • Download URL: pytest-copie-0.1.0.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for pytest-copie-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f9a4f3a9daa2be52878f2e226f96aec17aab8a0e22916596d4f2164f076ee06c
MD5 54cc99d007c971628bd800d8df907a01
BLAKE2b-256 67349943cf61f069169717e2a46fa0ddebc827953be8b6e39ac43c62bae69903

See more details on using hashes here.

File details

Details for the file pytest_copie-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_copie-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 42ab7b0683b17532553c3ef564e5cdfb103fd2f11d98cf6fdff64be199289f8b
MD5 d2f23dea76ce8983f6a5edbbf9a65fbf
BLAKE2b-256 05b8f7873b9bcd639b21001cfa10c31b552a1011849f7bedd64297d697d879d5

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