-
Notifications
You must be signed in to change notification settings - Fork 24
/
fabfile.py
48 lines (34 loc) · 1.37 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
from datetime import datetime
from fabric.api import local
from fabric.colors import _wrap_with
from fabric.context_managers import settings
green_bg = _wrap_with('42')
red_bg = _wrap_with('41')
def test_app(cli_args=''):
if len(cli_args.strip()) == 0:
source = 'realestate'
else:
source = cli_args.replace('.', '/')
command = "coverage run --source='%s' tests/runtests.py test %s;" % (source, cli_args)
command += "coverage report --omit=*tests*,*test_*,*migrations*," \
"*wsgi.py* --show-missing"
local('clear')
print("Test started at:")
print('\033[93m' + datetime.now().strftime("%I:%M:%S"))
print('\033[0m')
with settings(warn_only=True):
result = local(command)
if result.failed:
print(red_bg("Some tests failed"))
else:
print()
print(green_bg("All tests passed - have a banana!"))
def runserver(cli_args=''):
local('venv/bin/python testproject/manage.py runserver_plus 0.0.0.0:8000 %s' % cli_args)
def shell():
local('venv/bin/python testproject/manage.py shell_plus')
def local_deploy():
local('mv testproject/realestate.db testproject/realestate_bak.db')
local('venv/bin/python testproject/manage.py syncdb;', False)
local('venv/bin/python testproject/manage.py migrate')
local('venv/bin/python testproject/manage.py loaddata attributes.json')