Background Image
Table of Contents Table of Contents
Previous Page  106 / 478 Next Page
Information
Show Menu
Previous Page 106 / 478 Next Page
Page Background

things neat and tidy, let’s make a folder for our functional tests, so that it looks a bit like

an app. All Django needs is for it to be a valid Python module (ie, one with a

__in‐

it__.py

in it):

$

mkdir functional_tests

$

touch functional_tests/__init__.py

Then we

move

our functional tests, from being a standalone file called

function‐

al_tests.py

, to being the

tests.py

of the

functional_tests

app. We use

git mv

so that

Git notices that we’ve moved the file:

$

git mv functional_tests.py functional_tests/tests.py

$

git status

# shows the rename to functional_tests/tests.py and __init__.py

At this point your directory tree should look like this:

.

├── db.sqlite3

├── functional_tests

│ ├── __init__.py

│ └── tests.py

├── lists

│ ├── admin.py

│ ├── __init__.py

│ ├── migrations

│ │ ├── 0001_initial.py

│ │ ├── 0002_item_text.py

│ │ ├── __init__.py

│ │ └── __pycache__

│ ├── models.py

│ ├── __pycache__

│ ├── templates

│ │ └── home.html

│ ├── tests.py

│ └── views.py

├── manage.py

└── superlists

├── __init__.py

├── __pycache__

├── settings.py

├── urls.py

└── wsgi.py

functional_tests.py

is gone, and has turned into

functional_tests/tests.py

. Now, whenever

we want to run our functional tests, instead of running

python3 function

al_tests.py

, we will use

python3 manage.py test functional_tests

.

78

|

Chapter 6: Getting to the Minimum Viable Site