Skip to content

Commit e167d63

Browse files
author
Tobias Lorenz
committed
improved tox commands
1 parent 574b74c commit e167d63

File tree

9 files changed

+33
-7
lines changed

9 files changed

+33
-7
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ Contributors (in alphabetical order)
1010
* Philippe O. Wagner (philippeowagner)
1111
* Robert Węglarek (robertweglarek)
1212
* Yannik Ammann (yannik-ammann)
13+
* Tobias Lorenz (Tyrdall)

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Or you can initiate the database and preview your app in the browser
4848
./manage.py migrate --fake
4949
5050
# Django >= 1.8:
51-
./manage.py syncdb
51+
./manage.py migrate
5252
5353
./manage.py runserver
5454

template/MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ include DESCRIPTION
44
include CHANGELOG.txt
55
include README.md
66
include tox.ini
7+
include runtests.py
78
include requirements.txt
89
graft VAR_PACKAGE_NAME
910
global-exclude *.orig *.pyc *.log *.swp local_settings.py

template/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,5 @@ If you want to contribute to this project, please perform the following steps
7878
# Send us a pull request for your feature branch
7979
8080
In order to run the tests, simply execute ``tox``. This will install two new
81-
environments (for Django 1.6 and Django 1.7) and run the tests against both
81+
environments (for Django 1.7 and Django 1.8) and run the tests against both
8282
environments.

template/manage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
if __name__ == "__main__":
66
os.environ.setdefault('DJANGO_SETTINGS_MODULE',
7-
'VAR_PACKAGE_NAME.tests.south_settings')
7+
'VAR_PACKAGE_NAME.tests.settings')
88

99
from django.core.management import execute_from_command_line
1010

File renamed without changes.

template/runtests.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env python
2+
"""
3+
This script is used to run tests, create a coverage report and output the
4+
statistics at the end of the tox run.
5+
6+
To run this script just execute ``tox``
7+
8+
"""
9+
import re
10+
11+
from fabric.api import abort, local
12+
from fabric.colors import green, red
13+
14+
15+
if __name__ == '__main__':
16+
local('flake8 --ignore=E126 --ignore=W391 --statistics'
17+
' --exclude=submodules,migrations,build .')
18+
local('coverage run --source="VAR_PACKAGE_NAME" manage.py test -v 2'
19+
' --traceback --failfast --settings=VAR_PACKAGE_NAME.tests.settings'
20+
' --pattern="*_tests.py"')
21+
local('coverage html -d coverage'
22+
' --omit="*__init__*,*/settings/*,*/migrations/*,*/tests/*,*admin*"')
23+
total_line = local('grep -n pc_cov coverage/index.html', capture=True)
24+
percentage = float(re.findall(r'(\d+)%', total_line)[-1])
25+
if percentage < 100:
26+
abort(red('Coverage is {0}%'.format(percentage)))
27+
print(green('Coverage is {0}%'.format(percentage)))

template/test_requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ flake8
44
ipdb
55
mixer
66
mock
7-
south
87
tox
98
django-compat
109
six

template/tox.ini

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,4 @@ deps =
77
django17: Django>=1.7,<1.8
88
django18: Django>=1.8,<1.9
99
-rtest_requirements.txt
10-
commands =
11-
coverage run --source='VAR_PACKAGE_NAME' manage.py test -v 2 --traceback --failfast --settings=VAR_PACKAGE_NAME.tests.test_settings --pattern='*_tests.py'
12-
coverage html -d htmlcov
10+
commands = python runtests.py

0 commit comments

Comments
 (0)