{"id":24420,"library":"pytest-cookies","title":"pytest-cookies","description":"A pytest plugin for testing Cookiecutter templates. It provides a `cookies` fixture that wraps the Cookiecutter API for generating projects, making it easy to verify templates work as expected. Current version 0.7.0 supports Python >=3.7 and Cookiecutter >=2.1.0. Releases are infrequent but stable.","status":"active","version":"0.7.0","language":"python","source_language":"en","source_url":"https://github.com/hackebrot/pytest-cookies","tags":["pytest","cookiecutter","testing","template","plugin"],"install":[{"cmd":"pip install pytest-cookies","lang":"bash","label":"Install via pip"}],"dependencies":[{"reason":"Required plugin host.","package":"pytest","optional":false},{"reason":"Core dependency for template generation.","package":"cookiecutter","optional":false}],"imports":[{"note":"In v0.7.0, Result is in the plugin submodule; importing directly from pytest_cookies may fail.","wrong":"from pytest_cookies import Result","symbol":"Result","correct":"from pytest_cookies.plugin import Cookies, Result"}],"quickstart":{"code":"import os\n\ndef test_bake_project(cookies):\n    result = cookies.bake(extra_context={\"repo_name\": \"helloworld\"})\n    assert result.exit_code == 0\n    assert result.exception is None\n    assert result.project_path.name == \"helloworld\"\n    assert result.project_path.is_dir()","lang":"python","description":"Basic test for a Cookiecutter template using the cookies fixture."},"warnings":[{"fix":"Replace result.project with result.project_path (returns pathlib.Path).","message":"Result.project is deprecated in v0.6.0. Use Result.project_path instead.","severity":"deprecated","affected_versions":">=0.6.0"},{"fix":"Upgrade pytest-cookies to >=0.7.0.","message":"Cookiecutter 2.1.0 introduced breaking changes; pytest-cookies 0.7.0 is required for compatibility.","severity":"breaking","affected_versions":"<=0.6.1 with Cookiecutter >=2.1.0"},{"fix":"Run pytest with --keep-baked-projects flag to inspect generated files.","message":"By default, baked projects are deleted after the test. Use --keep-baked-projects CLI option to retain them.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install with pip install pytest-cookies and ensure the test file uses the 'cookies' fixture, not direct imports.","cause":"pytest-cookies not installed or not importable as a standalone module.","error":"ModuleNotFoundError: No module named 'pytest_cookies'"},{"fix":"Use result.project_path instead.","cause":"Using deprecated result.project which was removed in v0.6.0.","error":"AttributeError: 'Result' object has no attribute 'project'"},{"fix":"Check that the template path exists and Cookiecutter is properly configured.","cause":"Template baking failed, result is None.","error":"TypeError: 'NoneType' object is not subscriptable (when accessing result.project_path)"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}