diff options
Diffstat (limited to 'testsuite/common.py')
-rw-r--r-- | testsuite/common.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/testsuite/common.py b/testsuite/common.py index 396f1887b..9db2cb94a 100644 --- a/testsuite/common.py +++ b/testsuite/common.py @@ -219,12 +219,18 @@ class DBModelTestCase(Bcfg2TestCase): def test_syncdb(self): """ Create the test database and sync the schema """ if self.models: - import django.core.management import django - if django.VERSION[0] == 1 and django.VERSION[1] >= 7: - django.setup() + import django.core.management + from django.core.exceptions import ImproperlyConfigured + + if django.VERSION[0] == 1 and django.VERSION[1] < 7: + try: + django.core.management.call_command('syncdb', interactive=False, + verbosity=0) + except ImproperlyConfigured: + pass - django.core.management.call_command("syncdb", interactive=False, + django.core.management.call_command('migrate', interactive=False, verbosity=0) self.assertTrue( os.path.exists( |