Skip to content

Commit

Permalink
Merge pull request #135 from colab/fix-coverage-bug
Browse files Browse the repository at this point in the history
Fixing coverage order bug
  • Loading branch information
macartur committed Dec 8, 2015
2 parents ee51f9b + 40b3768 commit 0e0a11c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
long_description=open('README.rst').read(),
install_requires=REQUIREMENTS,
tests_require=TEST_REQUIREMENTS,
test_suite="tests.run.run_with_coverage",
test_suite="tests.run.runtests",
classifiers=[
'Development Status :: 3 - Alpha',
'Environment :: Web Environment',
Expand Down
19 changes: 9 additions & 10 deletions tests/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,16 @@
os.environ['COLAB_WIDGETS'] = 'tests/widgets.d'
os.environ['COVERAGE_PROCESS_START'] = '.coveragerc'


import django
import coverage

# Needs to come before the settings import, because some settings instantiate
# objetcs. If they are executed before the coverage startup, those lines
# won't be covered.
if os.path.exists('.coverage'):
os.remove('.coverage')
coverage.process_startup()

import django
from django.conf import settings
from django.test.utils import get_runner
import colab.settings
Expand All @@ -29,13 +35,6 @@ def runtests(test_suites=[]):
sys.exit(failures)


def run_with_coverage(test_suites=[]):
if os.path.exists('.coverage'):
os.remove('.coverage')
coverage.process_startup()
runtests(test_suites)


if __name__ == '__main__':
all_valid_apps = True

Expand All @@ -46,4 +45,4 @@ def run_with_coverage(test_suites=[]):
all_valid_apps = False

if all_valid_apps:
run_with_coverage(sys.argv[1:])
runtests(sys.argv[1:])

0 comments on commit 0e0a11c

Please sign in to comment.