summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2007-07-28 04:02:52 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2007-07-28 04:02:52 +0000
commit650cea9170313d9a2197d4050f6dcabaaeaa3b20 (patch)
tree971b87274c3a17d6e8df842ecf48a98d594602e1 /tests
parent5b8d2c9f0df1dbfadafeea6420fc5fc175e00376 (diff)
Fixed #4460 -- Added the ability to be more specific in the test cases that are executed. This is a backwards incompatible change for any user with a custom test runner. See the wiki for details.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5769 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rwxr-xr-xtests/runtests.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/tests/runtests.py b/tests/runtests.py
index 7b52445d84..56679ecb7c 100755
--- a/tests/runtests.py
+++ b/tests/runtests.py
@@ -73,7 +73,7 @@ class InvalidModelTestCase(unittest.TestCase):
self.assert_(not unexpected, "Unexpected Errors: " + '\n'.join(unexpected))
self.assert_(not missing, "Missing Errors: " + '\n'.join(missing))
-def django_tests(verbosity, interactive, tests_to_run):
+def django_tests(verbosity, interactive, test_labels):
from django.conf import settings
old_installed_apps = settings.INSTALLED_APPS
@@ -109,14 +109,13 @@ def django_tests(verbosity, interactive, tests_to_run):
# if the model was named on the command line, or
# no models were named (i.e., run all), import
# this model and add it to the list to test.
- if not tests_to_run or model_name in tests_to_run:
+ if not test_labels or model_name in set([label.split('.')[0] for label in test_labels]):
if verbosity >= 1:
print "Importing model %s" % model_name
mod = load_app(model_label)
if mod:
if model_label not in settings.INSTALLED_APPS:
settings.INSTALLED_APPS.append(model_label)
- test_models.append(mod)
except Exception, e:
sys.stderr.write("Error while importing %s:" % model_name + ''.join(traceback.format_exception(*sys.exc_info())[1:]))
continue
@@ -125,12 +124,12 @@ def django_tests(verbosity, interactive, tests_to_run):
extra_tests = []
for model_dir, model_name in get_invalid_models():
model_label = '.'.join([model_dir, model_name])
- if not tests_to_run or model_name in tests_to_run:
+ if not test_labels or model_name in test_labels:
extra_tests.append(InvalidModelTestCase(model_label))
# Run the test suite, including the extra validation tests.
from django.test.simple import run_tests
- failures = run_tests(test_models, verbosity=verbosity, interactive=interactive, extra_tests=extra_tests)
+ failures = run_tests(test_labels, verbosity=verbosity, interactive=interactive, extra_tests=extra_tests)
if failures:
sys.exit(failures)