Jake Hayes' personal blog
Note: This post is still a work in progress.
This kata simulates a babysitter working and getting paid for one night. The rules are pretty straight forward.
For this exercise I was given the option to select my own language from a list, I decided to go with Python as it is one of the languages I am most comfortable with. After spending over a year listening to both the PythonBytes and Test & Code podcasts, I had heard enough from Brian Okken to use pytest as the “test” part of my test driven development.
Having never used pytest before, I decided to buy Brian’s book so that I could get a good foundation of how pytest specifically worked. As a side note, I would recommend pytest if you are working on a python project. So I spent a couple of hours storming through that book so that I would have some idea of what I was doing.
After establishing that I was going to use pytest, I planned out the rest of what I was going to use for this project. To make it easier to develop on multiple machines I decided to use virtualenv. This way to use this package on another machine, all I would need to do (after using pip to install virtualenv) is install the packages in the requirements.txt file using
pip install -r requirements.txt and then the package is ready to go.
The other package in requirements.txt file other than pytest is Click. Click is a very powerful package that makes adding a command line interface (CLI) to your python package very easy. Using decorators and functions, defining a CLI is very easy.