Skip to content

Commit

Permalink
Added Django 1.2 compatibility by accepting the failfast test runner …
Browse files Browse the repository at this point in the history
…option. Probably breaks <1.2 compatibility.
  • Loading branch information
akaihola committed Sep 8, 2010
1 parent a5ef307 commit 568d192
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 15 deletions.
16 changes: 8 additions & 8 deletions src/test_extensions/testrunners/codecoverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ def get_all_coverage_modules(app_module):

return mod_list

def run_tests(test_labels, verbosity=1, interactive=True,
extra_tests=[], nodatabase=False, xml_out=False, callgraph=False):
def run_tests(test_labels, verbosity=1, interactive=True, failfast=False,
extra_tests=[], nodatabase=False, xml_out=False, callgraph=False):
"""
Test runner which displays a code coverage report at the end of the
run.
Expand Down Expand Up @@ -146,11 +146,11 @@ def run_tests(test_labels, verbosity=1, interactive=True,

if nodatabase:
results = nodatabase_run_tests(test_labels, verbosity, interactive,
extra_tests)
failfast, extra_tests)
else:
results = django_test_runner(test_labels, verbosity, interactive,
extra_tests)
failfast, extra_tests)

if callgraph and pycallgraph_enabled:
pycallgraph.stop_trace()

Expand Down Expand Up @@ -191,7 +191,7 @@ def run_tests(test_labels, verbosity=1, interactive=True,
return results


def run_tests_xml (test_labels, verbosity=1, interactive=True,
extra_tests=[], nodatabase=False):
return run_tests(test_labels, verbosity, interactive,
def run_tests_xml(test_labels, verbosity=1, interactive=True, failfast=False,
extra_tests=[], nodatabase=False):
return run_tests(test_labels, verbosity, interactive, failfast,
extra_tests, nodatabase, xml_out=True)
6 changes: 4 additions & 2 deletions src/test_extensions/testrunners/figleafcoverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@

import figleaf

def run_tests(test_labels, verbosity=1, interactive=True, extra_tests=[]):
def run_tests(test_labels,
verbosity=1, interactive=True, failfast=False, extra_tests=[]):
setup_test_environment()
figleaf.start()
test_results = django_test_runner(test_labels, verbosity, interactive, extra_tests)
test_results = django_test_runner(
test_labels, verbosity, interactive, failfast, extra_tests)
figleaf.stop()
if not os.path.isdir(os.path.join("temp", "figleaf")): os.makedirs(os.path.join("temp", "figleaf"))
file_name = "temp/figleaf/test_output.figleaf"
Expand Down
13 changes: 9 additions & 4 deletions src/test_extensions/testrunners/nodatabase.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

import coverage

def run_tests(test_labels, verbosity=1, interactive=True, extra_tests=[]):
def run_tests(test_labels,
verbosity=1, interactive=True, failfast=False, extra_tests=[]):
"""
Run the unit tests for all the test labels in the provided list.
Labels must be of the form:
Expand Down Expand Up @@ -71,7 +72,7 @@ def run_tests(test_labels, verbosity=1, interactive=True, extra_tests=[]):

return len(result.failures) + len(result.errors)

def run_tests_with_coverage(test_labels, verbosity=1, interactive=True, extra_tests=[], xml_out=False):
def run_tests_with_coverage(test_labels, verbosity=1, interactive=True, failfast=False, extra_tests=[], xml_out=False):
"""
Run the unit tests for all the test labels in the provided list.
Labels must be of the form:
Expand Down Expand Up @@ -151,6 +152,10 @@ def run_tests_with_coverage(test_labels, verbosity=1, interactive=True, extra_te

return len(result.failures) + len(result.errors)

def run_tests_with_xmlcoverage(test_labels, verbosity=1, interactive=True, extra_tests=[]):
return run_tests_with_coverage(test_labels, verbosity, interactive, extra_tests, xml_out=True)

def run_tests_with_xmlcoverage(
test_labels, verbosity=1, interactive=True, failfast=False, extra_tests=[]):

return run_tests_with_coverage(
test_labels,
verbosity, interactive, failfast, extra_tests, xml_out=True)
3 changes: 2 additions & 1 deletion src/test_extensions/testrunners/xmloutput.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ def run_suite(self, suite, **kwargs):
except NameError: # DjangoTestSuiteRunner is not available in Django < 1.2
pass

def run_tests(test_labels, verbosity=1, interactive=True, extra_tests=[]):
def run_tests(test_labels,
verbosity=1, interactive=True, failfast=False, extra_tests=[]):
setup_test_environment()

settings.DEBUG = False
Expand Down

0 comments on commit 568d192

Please sign in to comment.