Skip to content

Commit e61f3a7

Browse files
author
Joachim Jablon
committed
Simplified coverage step
1 parent cc2de36 commit e61f3a7

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ test-all: ## run tests on every Python version with tox
2727

2828
coverage: ## check code coverage quickly with the default Python
2929
coverage run --source django_readonly_field runtests.py
30-
coverage report -m
31-
coverage html
3230

3331
docs: ## generate Sphinx HTML documentation, including API docs
3432
rm -f docs/django-readonly-field.rst

runtests.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,21 @@
1717

1818

1919
def run_tests(*test_args):
20+
do_coverage = "COVERAGE" in os.environ
21+
22+
if do_coverage:
23+
import coverage
24+
cov = coverage.Coverage(source=["django_readonly_field"])
25+
cov.start()
26+
print("Coverage will be generated")
27+
2028
from django.core.management import execute_from_command_line
2129
execute_from_command_line(["", "test", ] + sys.argv[1:])
2230

31+
if do_coverage:
32+
cov.stop()
33+
cov.save()
34+
2335

2436
if __name__ == '__main__':
2537
run_tests(*sys.argv[1:])

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ envlist =
33
{py27,py35}-django{18,19,110},linters
44

55
[testenv]
6-
passenv = DATABASE_URL
6+
passenv = DATABASE_URL COVERAGE
77
setenv =
88
PYTHONPATH = {toxinidir}:{toxinidir}/django_readonly_field
99
commands =

0 commit comments

Comments
 (0)