#!/usr/bin/env python
import sys
from os.path import dirname, abspath

from django.conf import settings

if not settings.configured:
    settings.configure(
        DATABASE_ENGINE = 'sqlite3',
        # DATABASE_ENGINE = 'postgresql_psycopg2',
        # DATABASE_NAME = 'test_main',
        INSTALLED_APPS = [
            'django.contrib.contenttypes',
            'generic_aggregation.generic_aggregation_tests',
        ],
    )

from django.test.simple import run_tests


def runtests(*test_args):
    if not test_args:
        test_args = ['generic_aggregation_tests']
    parent = dirname(abspath(__file__))
    sys.path.insert(0, parent)
    failures = run_tests(test_args, verbosity=1, interactive=True)
    sys.exit(failures)


if __name__ == '__main__':
    runtests(*sys.argv[1:])

@@ -101,16 +101,211 @@
 ngs%0A%0Aif 
+len(sys.argv) %3E 1 and 'postgres' in sys.argv:%0A    sys.argv.remove('postgres')%0A    db_engine = 'postgresql_psycopg2'%0A    db_name = 'test_main'%0Aelse:%0A    db_engine = 'sqlite3'%0A    db_name = ''%0A%0Aif 
 not sett
@@ -349,54 +349,15 @@
 re(%0A
-        DATABASE_ENGINE = 'sqlite3',%0A    
     
-#
+   
  DAT
@@ -371,37 +371,25 @@
 NGINE = 
-'postgresql_psycopg2'
+db_engine
 ,%0A      
@@ -393,10 +393,8 @@
     
- #
  DAT
@@ -406,27 +406,23 @@
 _NAME = 
-'test_main'
+db_name
 ,%0A      

Allow running with postgres