This repository contains all the example code from my book, "Test-Driven Web Development with Python", available at www.obeythetestinggoat.com
Each chapter in the book has its own branch, which contains all the commits for that chapter. So, the state of the code in a branch is the state of the code at the end of that chapter.
In other words, if you want to start on a particular chapter in the book, you should check out the code for the previous chapter.
So, eg, chapter_05 has all the commits up to the end of chapter 5, so it's the branch to check out if you want to skip to the beginning of chapter 6.
Branches follow the syntax chapter_XX, so they're zero-padded.
Here are some notes on this book by somebody else.
Another useful notes on Python in VSCode.
- created a new virtual environment and installed the necessary packages,
Django among others (
pip install -r requirements.txt
) - activated the virtual environment.
django-admin startproject superlists
. This has createdsuperlist
folder with anothersuperlist
subfolder.cd superlists
- create the database:
python manage.py migrate
- test it's working:
python manage.py runserver
python manage.py startapp lists
- added
lists
to installed applications insettings.py
mkdir func_tests
cd func_tests
touch __init__.py
python manage.py migrate
python manage.py runserver
and openhttp://localhost:8000
- run a single test:
python func_tests\func_tests.py
- run unit tests:
python manage.py tests
When refactoring, work on either the code or the tests, but not both at once!