diff --git a/django/core/management/commands/test.py b/django/core/management/commands/test.py
index 8ebf3da..b57a2f0 100644
--- a/django/core/management/commands/test.py
+++ b/django/core/management/commands/test.py
@@ -6,6 +6,8 @@ class Command(BaseCommand):
     option_list = BaseCommand.option_list + (
         make_option('--noinput', action='store_false', dest='interactive', default=True,
             help='Tells Django to NOT prompt the user for input of any kind.'),
+        make_option('--coverage', action='store_true', dest='coverage', default=False,
+            help='Tells Django to run coverage analysis on your test modules.'),
     )
     help = 'Runs the test suite for the specified applications, or the entire site if no apps are specified.'
     args = '[appname ...]'
@@ -18,8 +20,48 @@ class Command(BaseCommand):
 
         verbosity = int(options.get('verbosity', 1))
         interactive = options.get('interactive', True)
+        use_coverage = options.get('coverage', False)
         test_runner = get_runner(settings)
 
+
+        if use_coverage:
+            try:
+                import coverage
+                if verbosity > 1:
+                    print "Running test runner with coverage."
+                #coverage.use_cache(0)
+                coverage.start()
+            except:
+                if verbosity > 0:
+                    print "coverage.py module is not available."
+                use_coverage = False
+
         failures = test_runner(test_labels, verbosity=verbosity, interactive=interactive)
+
         if failures:
             sys.exit(failures)
+
+        #We only want coverage when our tests are passing.
+        if use_coverage:
+            coverage.stop()
+            coverage_models = []
+            if test_labels:
+                for label in test_labels:
+                    if '.' in label:
+                        #Test the app, don't know if we really want coverage here.
+                        label = label.split('.')[0]
+                    coverage_models.append(__import__(label, globals(), locals(), ['']))
+            else:
+                from django.db.models.loading import get_apps
+                for app in get_apps():
+                    if app.__name__.find('django.contrib') == -1:
+                        coverage_models.append(app)
+
+
+            print '---------------------------------------------------------------'
+            print ' Unit Test Code Coverage Results'
+            print '---------------------------------------------------------------'
+
+            coverage.report(coverage_models, show_missing=1)
+
+            print '---------------------------------------------------------------'
