Extract run_test() method in back end tests.

(imported from commit 264bf689b282fccf8b4e423060fe0c4d2708b934)
This commit is contained in:
Steve Howell 2013-06-20 12:41:18 -04:00
parent e0c05ea7a9
commit cdc095c3b3
1 changed files with 5 additions and 7 deletions

View File

@ -2945,6 +2945,10 @@ class MyResult:
''' '''
sys.exit(1) sys.exit(1)
def run_test(test):
result = MyResult()
test(result)
class Runner(DjangoTestSuiteRunner): class Runner(DjangoTestSuiteRunner):
option_list = () option_list = ()
@ -2952,14 +2956,8 @@ class Runner(DjangoTestSuiteRunner):
DjangoTestSuiteRunner.__init__(self, *args, **kwargs) DjangoTestSuiteRunner.__init__(self, *args, **kwargs)
def run_suite(self, suite): def run_suite(self, suite):
# This is a simplified version of run_suite
# that does simple iteration and plugs in our
# own Results class that allows us to fail fast
# and add easy hooks to show which tests are running
# in real time.
result = MyResult()
for test in suite: for test in suite:
test(result) run_test(test)
# Subsume run_tests under our control. This is literally copied # Subsume run_tests under our control. This is literally copied
# from /Library/Python/2.7/site-packages/django/test/simple.py. # from /Library/Python/2.7/site-packages/django/test/simple.py.