pytest-cookies

The pytest plugin for your Cookiecutter templates. 🍪

MIT License

Downloads
40.9K
Stars
181
Committers
12
pytest-cookies - 0.7.0 Latest Release

Published by hackebrot over 1 year ago

Fixes for Cookiecutter v2.1.0 and newer (#63).

pytest-cookies - 0.6.1

Published by hackebrot over 3 years ago

Update bdist_wheel info in setup.cfg.

pytest-cookies - 0.6.0

Published by hackebrot over 3 years ago

Update dependencies and require Python 3.6 or newer. Return a pathlib.Path to the generated project via Result.project_path and add deprecation warning for Result.project:

def test_bake_project(cookies):
    result = cookies.bake(extra_context={"repo_name": "helloworld"})

    assert result.exit_code == 0
    assert result.exception is None

    assert result.project_path.name == "helloworld"
    assert result.project_path.is_dir()

    # The `project` attribute is deprecated
    assert result.project.basename == "helloworld"
    assert result.project.isdir()
pytest-cookies - 0.5.1

Published by hackebrot over 4 years ago

Allow bug fix releases of Cookiecutter. 🍪

pytest-cookies - 0.5.0

Published by hackebrot over 4 years ago

Adds the session-scoped cookies_session fixture for baking projects. 🍪

pytest-cookies - 0.4.0

Published by hackebrot over 5 years ago

By default cookies removes baked projects. This release adds a new CLI option to keep generated projects:

pytest --keep-baked-projects
pytest-cookies - 0.3.0

Published by hackebrot about 7 years ago

Add capability to specify the template directory via bake().

@pytest.fixture
def custom_template():
return "templates/minimal/"


def test_bake_custom_project(cookies, custom_template):
    """Test for generating a new project."""
    result = cookies.bake(template=custom_template)

    assert result.exit_code == 0
    assert result.exception is None
    assert result.project.basename == 'example-project'
    assert result.project.isdir()

Please see the documentation for more information.

pytest-cookies - 0.2.0

Published by hackebrot over 8 years ago

Upgrade to Cookiecutter Shortbread which fixed user config based replay_dir and cookiecutters_dir.

pytest-cookies -

Published by hackebrot about 9 years ago

cookies.bake()

pytest is a mature full-featured Python testing tool that provides easy
no boilerplate testing. Its hook-baesd customization system supports integration
of external plugins such as pytest-cookies.

This plugin comes with a cookies fixture which is a wrapper for the
cookiecutter 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.

Usage

The cookies.bake() method generates a new project from your template based on the
default values specified in cookiecutter.json:

def test_bake_project(cookies):
    result = cookies.bake(extra_context={'repo_name': 'helloworld'})

    assert result.exit_code == 0
    assert result.exception is None
    assert result.project.basename == 'helloworld'
    assert result.project.isdir()

It accepts the extra_context keyword argument that will be
passed to cookiecutter. The given dictionary will override the default values
of the template context, allowing you to test arbitrary user input data.

Please see the Injecting Extra Context section of the
official cookiecutter documentation.

Package Rankings
Top 34.56% on Conda-forge.org
Top 2.89% on Pypi.org