Skip to content

My notes from the book Test-Driven Development with Python.

License

Notifications You must be signed in to change notification settings

smenjas/tdd-with-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Test-Driven Development with Python

These are my notes from the book Test-Driven Development with Python.

I've used the book as a guide, and deviated occasionally.

First, install dependencies and create the environment.

# Install Homebrew.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

# Install the project dependencies.
brew install python3
brew install geckodriver
brew cask install firefox

# Create a Git repository.
git init ~/src/myproject
cd ~/src/myproject

# Create a virtual environment, in the directory "venv".
python3 -m venv virtualenv venv

# Create a .gitignore file.
echo '*.log' >> .gitignore
echo '*.pyc' >> .gitignore
echo '__pycache__' >> .gitignore
echo 'db.sqlite3' >> .gitignore
echo 'venv' >> .gitignore
git add .gitignore

# Commit the .gitignore file.
git commit -m "Add a .gitignore file."

For development and testing, activate virtualenv with this command:

source venv/bin/activate

Once you've activated the virtualenv, install Django & Selenium:

pip install "django<1.12" "selenium<4"

When you're done with development and testing, deactivate virtualenv:

deactivate

Create a new Django project:

django-admin startproject myproject .

Start a web server:

python manage.py runserver

Run my functional tests.

python functional_tests.py

License

Released as open source software under the terms of the ISC License.

Releases

No releases published

Packages

No packages published