Permalink
Browse files

Changed runtests.py to permit running individual tests.

  • Loading branch information...
Malcolm Tredinnick
Malcolm Tredinnick committed May 17, 2009
1 parent 4164ca5 commit 77ff245411053bfc9c253b34a4b8caedb955c31a
Showing with 12 additions and 4 deletions.
  1. +12 −4 testing/runtests.py
View
@@ -10,20 +10,28 @@
import os
import sys
-import test_settings
from django.conf import settings
from django.core import management
+import test_settings
+
def main(argv=None):
"""
Does the equivalent of "django-admin.py test acacia" after doing some basic
- configuration.
+ configuration. Caller can also pass in the names of particular TestCase or
+ test method to run, as per the normal unittest calling style. In that case,
+ those tests are run, instead of the full suite.
"""
if argv is None:
argv = sys.argv
+ if len(argv) == 1:
+ # No particular tests requested. Run the whole suite.
+ args = [argv[0], "test", "acacia"]
+ else:
+ args = [argv[0], "test"] + argv[1:]
# Ensure the local version of "acacia" is directly importable
- pkg_dir = os.path.join(os.path.dirname(__file__), "..")
+ pkg_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
sys.path.insert(0, pkg_dir)
options = {}
@@ -32,7 +40,7 @@ def main(argv=None):
options[name] = getattr(test_settings, name)
settings.configure(**options)
- controller = management.ManagementUtility([argv[0], "test", "acacia"])
+ controller = management.ManagementUtility(args)
controller.execute()

0 comments on commit 77ff245

Please sign in to comment.