Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automated testing for cookiecutters

cookiecutters are template generators that are massively useful in generating projects in a range of languages. However, I was wondering if there's a way to consistently test them? I want to generate not only the final product (make assertions about the existence, name and content of the target files given a set of inputs) but also that the generation will run without errors with certain inputs but reject others. What's the best approach for this? I know I could write a simple test case but it would not have access to the command line inputs, would it? Is there any way to access that function and feed it the command line options as args?

like image 550
Chris vCB Avatar asked Oct 20 '18 12:10

Chris vCB


1 Answers

https://github.com/hackebrot/pytest-cookies

The pytest plugin for your Cookiecutter templates 🍪

like image 87
michaeljoseph Avatar answered Sep 17 '22 17:09

michaeljoseph