forked from mbrochh/tdd-with-django-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfabfile.py
60 lines (43 loc) · 1.8 KB
/
fabfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
"""
Fabfile for the ``myproject`` project.
Fabric is similar to make files. Your team will be able to execute common
tasks via running ``fab taskname`` from the folder that contains the
``fabfile.py``.
"""
from fabric.api import local
def dumpdata():
"""
Calls dumpdata for all apps.
Remember to add new dumpdata commands for new apps here so that you always
get a full initial dump when running this task.
Is used by the ``fab rebuild`` task.
"""
local('python2.7 ./manage.py dumpdata --indent 4 --natural auth --exclude auth.permission > myproject/fixtures/bootstrap_auth.json') # NOQA
local('python2.7 ./manage.py dumpdata --indent 4 --natural sites > myproject/fixtures/bootstrap_sites.json') # NOQA
local('python2.7 ./manage.py dumpdata --indent 4 --natural myapp > myapp/fixtures/bootstrap.json') # NOQA
def loaddata():
"""
Loads the bootstrap fixtures so you can start clicking around on the site.
Is used by the ``fab rebuild`` task.
"""
local('python2.7 manage.py loaddata bootstrap_auth.json')
local('python2.7 manage.py loaddata bootstrap_sites.json')
local('python2.7 manage.py loaddata bootstrap.json')
def rebuild():
"""
Deletes the database and recreates the database and bootstrap fixtures.
"""
local('python2.7 manage.py reset_db --router=default --noinput')
local('python2.7 manage.py syncdb --all --noinput')
local('python2.7 manage.py migrate --fake')
loaddata()
def test(integration=1):
"""
Your central command for running tests. Call it like so:
fab test
fab test:integration=0
"""
command = './manage.py test -v 2 --settings=myproject.test_settings'
if int(integration) == 0:
command += " --exclude='integration_tests' --exclude='jasmine_tests'"
local(command)