mirror of
https://github.com/django/django.git
synced 2025-07-05 18:29:11 +00:00
Merging against SVN
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/test-improvements@10964 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
1a40a4fef7
commit
07558693b3
@ -158,6 +158,7 @@ class DefaultTestRunner(object):
|
||||
"""
|
||||
self.isloaded = True
|
||||
|
||||
|
||||
def run_tests(self, test_labels, verbosity=1, interactive=True, extra_tests=[]):
|
||||
"""
|
||||
Run the unit tests for all the test labels in the provided list.
|
||||
|
@ -1,11 +1,13 @@
|
||||
import coverage, time
|
||||
|
||||
import os, sys
|
||||
|
||||
from django.conf import settings
|
||||
from django.db.models import get_app, get_apps
|
||||
from django.test.simple import DefaultTestRunner
|
||||
|
||||
from django.utils.module_tools import get_all_modules, find_or_load_module
|
||||
from django.test.simple import DefaultTestRunner as base_run_tests
|
||||
|
||||
from django.utils.module_tools import get_all_modules
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
def _get_app_package(app_model_module):
|
||||
@ -25,6 +27,7 @@ class BaseCoverageRunner(object):
|
||||
self.cov = coverage.coverage(cover_pylib=True)
|
||||
self.cov.erase()
|
||||
|
||||
|
||||
def run_tests(self, test_labels, verbosity=1, interactive=True,
|
||||
extra_tests=[]):
|
||||
"""
|
||||
@ -43,6 +46,7 @@ class BaseCoverageRunner(object):
|
||||
results = brt.run_tests(test_labels, verbosity, interactive, extra_tests)
|
||||
self.cov.stop()
|
||||
|
||||
|
||||
coverage_modules = []
|
||||
if test_labels:
|
||||
for label in test_labels:
|
||||
@ -62,6 +66,7 @@ class BaseCoverageRunner(object):
|
||||
# self.cov.analysis2(ModuleVars(mods, self.modules[mods]).source_file)
|
||||
#coverage.analysis2(self.modules[mods])
|
||||
self.cov.report(self.modules.values(), show_missing=1)
|
||||
|
||||
if self.excludes:
|
||||
print >> sys.stdout
|
||||
print >> sys.stdout, _("The following packages or modules were excluded:"),
|
||||
@ -74,7 +79,7 @@ class BaseCoverageRunner(object):
|
||||
for e in self.errors:
|
||||
print >> sys.stderr, e,
|
||||
print >> sys.stdout
|
||||
#coverage._the_coverage.save()
|
||||
|
||||
return results
|
||||
|
||||
|
||||
@ -110,6 +115,7 @@ class ReportingCoverageRunner(BaseCoverageRunner):
|
||||
self.cov.html_report(self.modules.values(), directory=self.outdir, ignore_errors=True, omit_prefixes='modeltests')
|
||||
#cov.report(self.modules.values(), self.outdir)
|
||||
#coverage._the_coverage.html_report(self.modules.values(), self.outdir)
|
||||
|
||||
print >>sys.stdout
|
||||
print >>sys.stdout, _("HTML reports were output to '%s'") %self.outdir
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user