diff options
Diffstat (limited to 'testsuite/common.py')
-rw-r--r-- | testsuite/common.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/testsuite/common.py b/testsuite/common.py index 45cfcbf0b..396f1887b 100644 --- a/testsuite/common.py +++ b/testsuite/common.py @@ -15,7 +15,10 @@ import codecs import lxml.etree import Bcfg2.Options import Bcfg2.Utils -from mock import patch, MagicMock, _patch, DEFAULT +try: + from mock.mock import patch, MagicMock, _patch, DEFAULT +except ImportError: + from mock import patch, MagicMock, _patch, DEFAULT try: from unittest2 import skip, skipIf, skipUnless, TestCase except ImportError: @@ -217,6 +220,10 @@ class DBModelTestCase(Bcfg2TestCase): """ 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() + django.core.management.call_command("syncdb", interactive=False, verbosity=0) self.assertTrue( |