我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用django.conf.settings.configure()。
def run(*args): """ Check and/or create dj-stripe Django migrations. If --check is present in the arguments then migrations are checked only. """ if not settings.configured: settings.configure(**DEFAULT_SETTINGS) django.setup() parent = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, parent) if "--check" in args: check_migrations() else: django.core.management.call_command("makemigrations", APP_NAME, *args)
def run(self): from django.conf import settings settings.configure( INSTALLED_APPS=('collectionfield.tests',), SECRET_KEY='AAA', DATABASES={ 'default': { 'NAME': ':memory:', 'ENGINE': 'django.db.backends.sqlite3' } }, MIDDLEWARE_CLASSES = () ) from django.core.management import call_command import django django.setup() call_command('test', 'collectionfield')
def run(self): from django.conf import settings settings.configure( DATABASES={ 'default': { 'NAME': ':memory:', 'ENGINE': 'django.db.backends.sqlite3' } }, INSTALLED_APPS=('calaccess_processed',), MIDDLEWARE_CLASSES=() ) from django.core.management import call_command import django django.setup() call_command('test', 'calaccess_processed')
def pytest_configure(): from django.conf import settings settings.configure( DEBUG_PROPAGATE_EXCEPTIONS=True, DATABASES={'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:'}}, SITE_ID=1, SECRET_KEY='not very secret in tests', USE_I18N=True, USE_L10N=True, INSTALLED_APPS=( 'gstorage.apps.GStorageTestConfig', ), ) try: import django django.setup() except AttributeError: pass
def setUpClass(cls): from django.test.utils import setup_test_environment from django.core.management import call_command from django.conf import settings settings.configure( INSTALLED_APPS=[ 'django.contrib.auth', 'django.contrib.contenttypes', 'lifter.contrib.django', ], DATABASES={ 'default': {'NAME': ':memory:', 'ENGINE': 'django.db.backends.sqlite3'} }, ) django.setup() setup_test_environment() super(DjangoTestCase, cls).setUpClass() call_command('migrate')
def runtests(*test_args): if not settings.configured: settings.configure(**DEFAULT_SETTINGS) django.setup() parent = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, parent) try: from django.test.runner import DiscoverRunner runner_class = DiscoverRunner test_args = ["pinax.news.tests"] except ImportError: from django.test.simple import DjangoTestSuiteRunner runner_class = DjangoTestSuiteRunner test_args = ["tests"] failures = runner_class(verbosity=1, interactive=True, failfast=False).run_tests(test_args) sys.exit(failures)
def run_test_suite(): settings.configure( DATABASES={ "default": { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(TESTS_ROOT, 'db.sqlite3'), "USER": "", "PASSWORD": "", "HOST": "", "PORT": "", }, }, INSTALLED_APPS=[ "django.contrib.auth", "django.contrib.contenttypes", "django.contrib.sessions", "django.contrib.sites", "rhouser", ], ) django.setup() execute_from_command_line(['manage.py', 'test'])
def runtests(*test_args): if not settings.configured: settings.configure(**DEFAULT_SETTINGS) django.setup() parent = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, parent) try: from django.test.runner import DiscoverRunner runner_class = DiscoverRunner test_args = ["pinax.cohorts.tests"] except ImportError: from django.test.simple import DjangoTestSuiteRunner runner_class = DjangoTestSuiteRunner test_args = ["tests"] failures = runner_class(verbosity=1, interactive=True, failfast=False).run_tests(test_args) sys.exit(failures)
def _tests_old(self): """ Fire up the Django test suite from before version 1.2 """ test_settings = self.custom_settings installed_apps = test_settings.pop('INSTALLED_APPS', ()) settings.configure( DEBUG=True, DATABASE_ENGINE='sqlite3', DATABASE_NAME=os.path.join(self.DIRNAME, 'database.db'), INSTALLED_APPS=tuple(self.INSTALLED_APPS + installed_apps + self.apps), **test_settings ) from django.test.simple import run_tests failures = run_tests(self.apps, verbosity=1) if failures: sys.exit(failures)
def _tests_1_2(self): """ Fire up the Django test suite developed for version 1.2 and up """ test_settings = self.custom_settings installed_apps = test_settings.pop('INSTALLED_APPS', ()) settings.configure( DEBUG=True, DATABASES=self.get_database(1.2), INSTALLED_APPS=tuple(self.INSTALLED_APPS + installed_apps + self.apps), **test_settings ) from django.test.simple import DjangoTestSuiteRunner failures = DjangoTestSuiteRunner().run_tests(self.apps, verbosity=1) if failures: sys.exit(failures)
def _tests_1_7(self): """ Fire up the Django test suite developed for version 1.7 and up """ test_settings = self.custom_settings installed_apps = test_settings.pop('INSTALLED_APPS', ()) settings.configure( DEBUG=True, DATABASES=self.get_database(1.7), MIDDLEWARE_CLASSES=('django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware'), INSTALLED_APPS=tuple(self.INSTALLED_APPS + installed_apps + self.apps), **test_settings ) from django.test.simple import DjangoTestSuiteRunner import django django.setup() failures = DjangoTestSuiteRunner().run_tests(self.apps, verbosity=1) if failures: sys.exit(failures)
def _tests_1_8(self): """ Fire up the Django test suite developed for version 1.8 and up """ test_settings = self.custom_settings installed_apps = test_settings.pop('INSTALLED_APPS', ()) settings.configure( DEBUG=True, DATABASES=self.get_database(1.8), MIDDLEWARE_CLASSES=('django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware'), INSTALLED_APPS=tuple(self.INSTALLED_APPS + installed_apps + self.apps), **test_settings ) from django.test.runner import DiscoverRunner import django django.setup() failures = DiscoverRunner().run_tests(self.apps, verbosity=1) if failures: sys.exit(failures)
def pytest_configure(): settings.configure( MIDDLEWARE=[ 'django_aws_xray.middleware.XRayMiddleware' ], INSTALLED_APPS=[ 'django_aws_xray', 'tests.app', ], CACHES={ 'default': { 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', 'LOCATION': 'unique-snowflake', } }, DATABASES={ 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'db.sqlite', }, }, ROOT_URLCONF='tests.app.urls', AWS_XRAY_HOST='127.0.0.1', AWS_XRAY_PORT=2399, )
def test_django_cache(self): try: from django.conf import settings settings.configure(CACHE_BACKEND = 'locmem://') from django.core.cache import cache except ImportError: # no Django, so nothing to test return congress = Congress(API_KEY, cache) self.assertEqual(congress.http.cache, cache) self.assertEqual(congress.members.http.cache, cache) self.assertEqual(congress.bills.http.cache, cache) self.assertEqual(congress.votes.http.cache, cache) try: bills = congress.bills.introduced('house') except Exception as e: self.fail(e)
def _new_tests(self): """ Fire up the Django test suite developed for version 1.2 """ settings.configure( DEBUG = True, DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(self.DIRNAME, 'database.db'), 'USER': '', 'PASSWORD': '', 'HOST': '', 'PORT': '', } }, INSTALLED_APPS = self.INSTALLED_APPS + self.apps ) from django.test.simple import DjangoTestSuiteRunner failures = DjangoTestSuiteRunner().run_tests(self.apps, verbosity=1) if failures: sys.exit(failures)
def runtests(*test_args): if not settings.configured: settings.configure(**DEFAULT_SETTINGS) django.setup() parent = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, parent) try: from django.test.runner import DiscoverRunner runner_class = DiscoverRunner test_args = ["pinax.api.tests"] except ImportError: from django.test.simple import DjangoTestSuiteRunner runner_class = DjangoTestSuiteRunner test_args = ["tests"] failures = runner_class(verbosity=1, interactive=True, failfast=False).run_tests(test_args) sys.exit(failures)
def run_tests(): # Making Django run this way is a two-step process. First, call # settings.configure() to give Django settings to work with: from django.conf import settings settings.configure(**SETTINGS_DICT) # Then, call django.setup() to initialize the application cache # and other bits: import django if hasattr(django, 'setup'): django.setup() # Now we instantiate a test runner... from django.test.utils import get_runner TestRunner = get_runner(settings) # And then we run tests and return the results. test_runner = TestRunner(verbosity=1, interactive=True) failures = test_runner.run_tests(['registration.tests']) sys.exit(bool(failures))
def run_tests(): # Making Django run this way is a two-step process. First, call # settings.configure() to give Django settings to work with: from django.conf import settings settings.configure(**SETTINGS_DICT) # Then, call django.setup() to initialize the application cache # and other bits: import django if hasattr(django, 'setup'): django.setup() # Now we instantiate a test runner... from django.test.utils import get_runner TestRunner = get_runner(settings) # And then we run tests and return the results. test_runner = TestRunner(verbosity=1, interactive=True) failures = test_runner.run_tests(['yandex_cash_register.tests']) sys.exit(bool(failures))
def configure_django(): import target_models django_db_url = urllib.parse.urlparse(os.environ['DATABASE_URL']) django_settings = { 'DATABASES': { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'HOST': django_db_url.hostname, 'NAME': django_db_url.path.lstrip('/'), 'USER': django_db_url.username, } }, 'INSTALLED_APPS': [ TargetModelsApp('target_models', target_models), ], } django_settings_module.configure(**django_settings) django.setup()
def run(command): if not settings.configured: settings.configure(**DEFAULT_SETTINGS) # Compatibility with Django 1.7's stricter initialization if hasattr(django, 'setup'): django.setup() parent = os.path.dirname(os.path.abspath(__file__)) appdir = os.path.join(parent, 'lbattachment') os.chdir(appdir) from django.core.management import call_command params = {} if command == 'make': params['locale'] = ['zh-Hans'] call_command('%smessages' % command, **params)
def runtests(): if not settings.configured: settings.configure(**DEFAULT_SETTINGS) # Compatibility with Django 1.7's stricter initialization if hasattr(django, 'setup'): django.setup() parent = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, parent) try: from django.test.runner import DiscoverRunner runner_class = DiscoverRunner test_args = ['lbattachment.tests'] except ImportError: from django.test.simple import DjangoTestSuiteRunner runner_class = DjangoTestSuiteRunner test_args = ['tests'] failures = runner_class( verbosity=1, interactive=True, failfast=False).run_tests(test_args) sys.exit(failures)
def runtests(): test_dir = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, test_dir) settings.configure( DEBUG=True, SECRET_KEY='123', DATABASES={ 'default': { 'ENGINE': 'django.db.backends.sqlite3' } }, INSTALLED_APPS=[ 'django.contrib.auth', 'django.contrib.contenttypes', 'drf_simple_auth' ], ROOT_URLCONF='drf_simple_auth.urls', TEMPLATES=[ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, }, ] ) django.setup() from django.test.utils import get_runner TestRunner = get_runner(settings) # noqa test_runner = TestRunner(verbosity=1, interactive=True) if hasattr(django, 'setup'): django.setup() failures = test_runner.run_tests(['drf_simple_auth']) sys.exit(bool(failures))
def pytest_configure(): settings.configure( STATIC_URL="/static/" ) django.setup()
def init_django(): # Making Django run this way is a two-step process. First, call # settings.configure() to give Django settings to work with: from django.conf import settings settings.configure(**SETTINGS_DICT) # Then, call django.setup() to initialize the application cache # and other bits: import django django.setup() # Originally we defined this as a session-scoped fixture, but that # broke django.test.SimpleTestCase instances' class setup methods, # so we need to call this function *really* early.
def test_01_overwrite_detection(self): """test detection of foreign monkeypatching""" # NOTE: this sets things up, and spot checks two methods, # this should be enough to verify patch manager is working. # TODO: test unpatch behavior honors flag. # configure plugin to use sample context config = "[passlib]\nschemes=des_crypt\n" self.load_extension(PASSLIB_CONFIG=config) # setup helpers import django.contrib.auth.models as models from passlib.ext.django.models import adapter def dummy(): pass # mess with User.set_password, make sure it's detected orig = models.User.set_password models.User.set_password = dummy with self.assertWarningList("another library has patched.*User\.set_password"): adapter._manager.check_all() models.User.set_password = orig # mess with models.check_password, make sure it's detected orig = models.check_password models.check_password = dummy with self.assertWarningList("another library has patched.*models:check_password"): adapter._manager.check_all() models.check_password = orig
def pytest_configure(): from django.conf import settings settings.configure( DEBUG_PROPAGATE_EXCEPTIONS=True, DATABASES={ 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:' } }, SECRET_KEY='not important here', ROOT_URLCONF='tests.urls', MIDDLEWARE_CLASSES=( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', ), INSTALLED_APPS=( 'django.contrib.auth', 'django.contrib.contenttypes', 'tests', 'rest_framework', ), PASSWORD_HASHERS=( 'django.contrib.auth.hashers.MD5PasswordHasher', ), REST_FRAMEWORK={ 'EXCEPTION_HANDLER': 'rest_framework_friendly_errors.handlers.friendly_exception_handler' }, LANGUAGE_CODE='pl' ) try: import django django.setup() except AttributeError: pass
def serve_django_app(settings_name): os.listdir = lambda path: [] os.environ['DJANGO_SETTINGS_MODULE'] = settings_name import django args = ['manage.py', 'runserver', '0:9191', '--noreload'] from django.conf import settings #settings.configure() django.setup() from django.core.management.commands import runserver runserver.Command().run_from_argv(args) #django.core.management.execute_from_command_line(args)
def pytest_configure(): settings.configure( INSTALLED_APPS=[ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.messages', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.staticfiles', ], MIDDLEWARE_CLASSES=[], POSTCODE_LOOKUP={}, CACHES={ 'default': { 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', 'LOCATION': 'unique-snowflake', } }, DATABASES={ 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'db.sqlite', }, } )
def pytest_configure(): from django.conf import settings settings.configure( ALEXA_BROWSER_CLIENT_AVS_CLIENT_ID='my-client-id', ALEXA_BROWSER_CLIENT_AVS_DEVICE_TYPE_ID='my-device-type-id', ALEXA_BROWSER_CLIENT_AVS_CLIENT_SECRET='my-client-secret', ALEXA_BROWSER_CLIENT_AVS_REFRESH_TOKEN='my-refresh-token', ROOT_URLCONF='alexa_browser_client.config.urls', CHANNEL_LAYERS={ 'default': { 'BACKEND': 'asgiref.inmemory.ChannelLayer', 'ROUTING': 'tests.config.routing.channel_routing', }, }, INSTALLED_APPS=['alexa_browser_client'], TEMPLATES=[ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', ], }, }, ] )
def pytest_configure(): settings.configure( MIDDLEWARE_CLASSES=[], CACHES={ 'default': { 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', 'LOCATION': 'unique-snowflake', } }, DATABASES={ 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'db.sqlite', }, }, INSTALLED_APPS=[ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django_rangepaginator', ], TEMPLATES=[ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] )
def run(*args): if not settings.configured: settings.configure(**DEFAULT_SETTINGS) django.setup() parent = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, parent) django.core.management.call_command( "makemigrations", "pinax_news", *args )
def pytest_configure(): settings.configure(DATABASES=seekconnection_settings.DATABASES)
def pytest_configure(): settings.configure(INSTALLED_APPS=[ 'django.contrib.contenttypes', ]) django.setup()
def run(*args): if not settings.configured: settings.configure(**DEFAULT_SETTINGS) django.setup() parent = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, parent) django.core.management.call_command( "makemigrations", "pinax_cohorts", *args )
def main(args): # Since this test suite is designed to be ran outside of ./manage.py test, we need to do some setup first. import django from django.conf import settings settings.configure(INSTALLED_APPS=['testapp'], DATABASES=DATABASES_FOR_DB[args.db]) django.setup() from django.test.runner import DiscoverRunner test_runner = DiscoverRunner(top_level=TESTS_DIR, interactive=False, keepdb=False) failures = test_runner.run_tests(['tests']) if failures: sys.exit(1)
def test_01_overwrite_detection(self): "test detection of foreign monkeypatching" # NOTE: this sets things up, and spot checks two methods, # this should be enough to verify patch manager is working. # TODO: test unpatch behavior honors flag. # configure plugin to use sample context config = "[passlib]\nschemes=des_crypt\n" self.load_extension(PASSLIB_CONFIG=config) # setup helpers import django.contrib.auth.models as models from passlib.ext.django.models import _manager def dummy(): pass # mess with User.set_password, make sure it's detected orig = models.User.set_password models.User.set_password = dummy with self.assertWarningList("another library has patched.*User\.set_password"): _manager.check_all() models.User.set_password = orig # mess with models.check_password, make sure it's detected orig = models.check_password models.check_password = dummy with self.assertWarningList("another library has patched.*models:check_password"): _manager.check_all() models.check_password = orig
def main(): if not settings.configured: module_root = path.dirname(path.realpath(__file__)) settings.configure( DEBUG = False, INSTALLED_APPS = ( 'private_storage', ), ) if django.VERSION >= (1,7): django.setup() makemessages()
def setup(): DB_FILE = NAME + '.db' with open(DB_FILE, 'w'): pass # wipe the database settings.configure( DEBUG=True, DATABASES={ DEFAULT_DB_ALIAS: { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': DB_FILE}}, LOGGING={'version': 1, 'disable_existing_loggers': False, 'formatters': { 'debug': { 'format': '%(asctime)s[%(levelname)s]' '%(name)s.%(funcName)s(): %(message)s', 'datefmt': '%Y-%m-%d %H:%M:%S'}}, 'handlers': { 'console': { 'level': 'DEBUG', 'class': 'logging.StreamHandler', 'formatter': 'debug'}}, 'root': { 'handlers': ['console'], 'level': 'WARN'}, 'loggers': { "django.db": {"level": "WARN"}}}) app_config = AppConfig(NAME, sys.modules['__main__']) apps.populate([app_config]) django.setup() original_new_func = ModelBase.__new__ @staticmethod def patched_new(cls, name, bases, attrs): if 'Meta' not in attrs: class Meta: app_label = NAME attrs['Meta'] = Meta return original_new_func(cls, name, bases, attrs) ModelBase.__new__ = patched_new
def pytest_configure(): settings.configure( DEBUG_PROPAGATE_EXCEPTIONS=True, DATABASES={'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:'}}, SITE_ID=1, SECRET_KEY='not very secret in tests', USE_I18N=True, USE_L10N=True, INSTALLED_APPS=( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'tests', ), ROOT_URLCONF='tests.urls', MIDDLEWARE_CLASSES=( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', ), TEMPLATES=[ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], 'loaders': [ 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader' ], }, }, ] )
def pytest_configure(): from django.conf import settings settings.configure( DEBUG_PROPAGATE_EXCEPTIONS=True, DATABASES={ "default": { "ENGINE": "django.db.backends.sqlite3", "NAME": ":memory:", } }, SECRET_KEY="not very secret in tests", USE_I18N=True, USE_L10N=True, USE_TZ=True, INSTALLED_APPS=( "django.contrib.auth", "django.contrib.contenttypes", "django.contrib.admin", "django.contrib.sites", "rest_framework", "aa_stripe" ), ROOT_URLCONF="aa_stripe.api_urls", TESTING=True, ENV_PREFIX="test-env", STRIPE_SETTINGS_API_KEY="apikey", STRIPE_SETTINGS_WEBHOOK_ENDPOINT_SECRET="fake" )
def pytest_configure(): # configure django settings settings.configure(**DJANGO_SETTINGS_DICT)
def test_01_overwrite_detection(self): """test detection of foreign monkeypatching""" # NOTE: this sets things up, and spot checks two methods, # this should be enough to verify patch manager is working. # TODO: test unpatch behavior honors flag. # configure plugin to use sample context config = "[passlib]\nschemes=des_crypt\n" self.load_extension(PASSLIB_CONFIG=config) # setup helpers import django.contrib.auth.models as models from passlib.ext.django.models import _manager def dummy(): pass # mess with User.set_password, make sure it's detected orig = models.User.set_password models.User.set_password = dummy with self.assertWarningList("another library has patched.*User\.set_password"): _manager.check_all() models.User.set_password = orig # mess with models.check_password, make sure it's detected orig = models.check_password models.check_password = dummy with self.assertWarningList("another library has patched.*models:check_password"): _manager.check_all() models.check_password = orig
def setup_django_template_system(): """Initialises the Django templating system as to be used standalone. """ settings.configure() settings.TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates' } ] django.setup()
def setUp(self): from django.conf import settings as django_settings from django.test.utils import setup_test_environment if not django_settings.configured: django_settings.configure() setup_test_environment()
def get_settings(): settings.configure( DEBUG=True, USE_TZ=True, DATABASES={ "default": { "ENGINE": "django.db.backends.sqlite3", } }, INSTALLED_APPS=[ "django.contrib.auth", "django.contrib.contenttypes", "django.contrib.sites", "django_elasticsearch_dsl", "tests", ], SITE_ID=1, MIDDLEWARE_CLASSES=(), ELASTICSEARCH_DSL={ 'default': { 'hosts': os.environ.get('ELASTICSEARCH_URL', 'localhost:9200') }, }, ) try: import django setup = django.setup except AttributeError: pass else: setup() return settings
def pytest_configure(): from django.conf import settings settings.configure()
def _old_tests(self): """ Fire up the Django test suite from before version 1.2 """ settings.configure(DEBUG = True, DATABASE_ENGINE = 'sqlite3', DATABASE_NAME = os.path.join(self.DIRNAME, 'database.db'), INSTALLED_APPS = self.INSTALLED_APPS + self.apps ) from django.test.simple import run_tests failures = run_tests(self.apps, verbosity=1) if failures: sys.exit(failures)