Commit 40b3768df1866b1d1a940c01a00130a5ac66f69f

Authored by Matheus de Sousa Faria
1 parent dda94022
Exists in master

Fixing coverage order bug

Signed-off-by: Matheus Faria <matheus.sousa.faria@gmail.com>
Signed-off-by: Macartur Sousa <macartur.sc@gmail.com>
Signed-off-by: Lucas Moura <lucas.moura128@gmail.com>
Showing 2 changed files with 10 additions and 11 deletions   Show diff stats
@@ -57,7 +57,7 @@ setup( @@ -57,7 +57,7 @@ setup(
57 long_description=open('README.rst').read(), 57 long_description=open('README.rst').read(),
58 install_requires=REQUIREMENTS, 58 install_requires=REQUIREMENTS,
59 tests_require=TEST_REQUIREMENTS, 59 tests_require=TEST_REQUIREMENTS,
60 - test_suite="tests.run.run_with_coverage", 60 + test_suite="tests.run.runtests",
61 classifiers=[ 61 classifiers=[
62 'Development Status :: 3 - Alpha', 62 'Development Status :: 3 - Alpha',
63 'Environment :: Web Environment', 63 'Environment :: Web Environment',
@@ -10,10 +10,16 @@ os.environ[&#39;COLAB_PLUGINS&#39;] = &#39;tests/plugins.d&#39; @@ -10,10 +10,16 @@ os.environ[&#39;COLAB_PLUGINS&#39;] = &#39;tests/plugins.d&#39;
10 os.environ['COLAB_WIDGETS'] = 'tests/widgets.d' 10 os.environ['COLAB_WIDGETS'] = 'tests/widgets.d'
11 os.environ['COVERAGE_PROCESS_START'] = '.coveragerc' 11 os.environ['COVERAGE_PROCESS_START'] = '.coveragerc'
12 12
13 -  
14 -import django  
15 import coverage 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 from django.conf import settings 23 from django.conf import settings
18 from django.test.utils import get_runner 24 from django.test.utils import get_runner
19 import colab.settings 25 import colab.settings
@@ -29,13 +35,6 @@ def runtests(test_suites=[]): @@ -29,13 +35,6 @@ def runtests(test_suites=[]):
29 sys.exit(failures) 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 if __name__ == '__main__': 38 if __name__ == '__main__':
40 all_valid_apps = True 39 all_valid_apps = True
41 40
@@ -46,4 +45,4 @@ if __name__ == &#39;__main__&#39;: @@ -46,4 +45,4 @@ if __name__ == &#39;__main__&#39;:
46 all_valid_apps = False 45 all_valid_apps = False
47 46
48 if all_valid_apps: 47 if all_valid_apps:
49 - run_with_coverage(sys.argv[1:]) 48 + runtests(sys.argv[1:])