Commit ce297d41276d311f67324ba872f4a32562bd166b

Authored by Sergio Oliveira
2 parents a4d38c8b 0e0a11ce
Exists in master

Merge branch 'master' of github.com:colab/colab

Showing 2 changed files with 10 additions and 11 deletions   Show diff stats
setup.py
... ... @@ -57,7 +57,7 @@ setup(
57 57 long_description=open('README.rst').read(),
58 58 install_requires=REQUIREMENTS,
59 59 tests_require=TEST_REQUIREMENTS,
60   - test_suite="tests.run.run_with_coverage",
  60 + test_suite="tests.run.runtests",
61 61 classifiers=[
62 62 'Development Status :: 3 - Alpha',
63 63 'Environment :: Web Environment',
... ...
tests/run.py
... ... @@ -10,10 +10,16 @@ os.environ['COLAB_PLUGINS'] = 'tests/plugins.d'
10 10 os.environ['COLAB_WIDGETS'] = 'tests/widgets.d'
11 11 os.environ['COVERAGE_PROCESS_START'] = '.coveragerc'
12 12  
13   -
14   -import django
15 13 import coverage
16 14  
  15 +# Needs to come before the settings import, because some settings instantiate
  16 +# objetcs. If they are executed before the coverage startup, those lines
  17 +# won't be covered.
  18 +if os.path.exists('.coverage'):
  19 + os.remove('.coverage')
  20 +coverage.process_startup()
  21 +
  22 +import django
17 23 from django.conf import settings
18 24 from django.test.utils import get_runner
19 25 import colab.settings
... ... @@ -29,13 +35,6 @@ def runtests(test_suites=[]):
29 35 sys.exit(failures)
30 36  
31 37  
32   -def run_with_coverage(test_suites=[]):
33   - if os.path.exists('.coverage'):
34   - os.remove('.coverage')
35   - coverage.process_startup()
36   - runtests(test_suites)
37   -
38   -
39 38 if __name__ == '__main__':
40 39 all_valid_apps = True
41 40  
... ... @@ -46,4 +45,4 @@ if __name__ == '__main__':
46 45 all_valid_apps = False
47 46  
48 47 if all_valid_apps:
49   - run_with_coverage(sys.argv[1:])
  48 + runtests(sys.argv[1:])
... ...