eggs/djangorecipe-0.20-py2.6.egg/djangorecipe/test.py
changeset 307 c6bca38c1cbf
equal deleted inserted replaced
306:5ff1fc726848 307:c6bca38c1cbf
       
     1 from django.core import management
       
     2 
       
     3 def main(settings_file, *apps):
       
     4     argv = ['test', 'test'] + list(apps)
       
     5     try:
       
     6         settings = __import__(settings_file)
       
     7         components = settings_file.split('.')
       
     8         for comp in components[1:]:
       
     9             settings = getattr(settings, comp)
       
    10     except ImportError, e:
       
    11         import sys
       
    12         sys.stderr.write("Error loading the settings module '%s': %s"
       
    13                             % (settings_file, e))
       
    14         return sys.exit(1)
       
    15 
       
    16     management.execute_manager(settings, argv=argv)