This directory contains tests for the cookiecutter template. The tests use pytest-cookies, a pytest plugin for testing cookiecutter templates.
- Install pytest and pytest-cookies:
pip install pytest pytest-cookies- Run the tests:
pytest -xvs tests/test_cookiecutter.pyAlternatively, if you're using uv (the fast Python package installer and resolver):
uv run pytest -xvs tests/test_cookiecutter.pyThe tests in test_cookiecutter.py cover the following scenarios:
- Default template generation: Tests that the template generates correctly with default values.
- Test execution in generated project: Tests that the generated project's own tests run successfully.
- VCS path registry: Tests proper configuration of supported version control systems.
- License file generation: Tests that the correct license file is generated based on selection.
- GitHub Actions workflow creation: Tests optional GitHub Actions workflow generation.
- Documentation creation: Tests optional documentation generation.
- pyproject.toml configuration: Tests proper project metadata configuration.
- README badge inclusion: Tests conditional inclusion of status badges in README.
- Package structure: Tests proper Python package directory structure.
If you encounter issues with the tests, you can keep the generated projects for inspection by adding the --keep-baked-projects flag:
pytest -xvs tests/test_cookiecutter.py --keep-baked-projectsThis can be helpful for debugging test failures as you can inspect the actual generated files.