Commit 2717360d by Ned Batchelder

Make this work with non-Django test suites also.

parent 5e288b60
#!/usr/bin/env python
from django.core import management
import argparse
import os
......@@ -42,12 +41,15 @@ def main(argv):
test_py_path = find_full_path(test_py_path)
test_spec = "%s:%s.%s" % (test_py_path, test_class, test_method)
settings = None
if test_py_path.startswith('cms'):
settings = 'cms.envs.test'
elif test_py_path.startswith('lms'):
settings = 'lms.envs.test'
else:
raise Exception("Couldn't determine settings to use!")
if settings:
# Run as a django test suite
from django.core import management
django_args = ["django-admin.py", "test", "--pythonpath=."]
django_args.append("--settings=%s" % settings)
......@@ -57,6 +59,16 @@ def main(argv):
print " ".join(django_args)
management.execute_from_command_line(django_args)
else:
# Run as a nose test suite
import nose.core
nose_args = ["nosetests"]
if args.nocapture:
nose_args.append("-s")
nose_args.append(test_spec)
print " ".join(nose_args)
nose.core.main(argv=nose_args)
if __name__ == "__main__":
main(sys.argv[1:])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment