def setUpModule(): if django is None: raise unittest.SkipTest(SKIPTEST_TEXT) django_test_utils.setup_test_environment() global DJANGO_RUNNER global DJANGO_RUNNER_STATE DJANGO_RUNNER = django_test_simple.DjangoTestSuiteRunner() DJANGO_RUNNER_STATE = DJANGO_RUNNER.setup_databases()
def setUpModule(): if django is None: # pragma: no cover raise unittest.SkipTest("Django not installed") django_test_utils.setup_test_environment() runner = django_test_simple.DjangoTestSuiteRunner() runner_state = runner.setup_databases() test_state.update({ 'runner': runner, 'runner_state': runner_state, })
def setUpModule(): if django is None: return django_test_utils.setup_test_environment() runner = django_test_simple.DjangoTestSuiteRunner() runner_state = runner.setup_databases() test_state.update({ 'runner': runner, 'runner_state': runner_state, })
def run(*test_args): if not test_args: test_args = ['tests'] parent = os.path.join( os.path.dirname(os.path.abspath(__file__)), "..", "..", ) sys.path.insert(0, parent) failures = test_simple.DjangoTestSuiteRunner().run_tests(test_args) sys.exit(failures)
def handle(self, check_app_name=None, **options): runner = simple.DjangoTestSuiteRunner(verbosity=0) err_msg = "Failed to migrate %s; see output for hints at missing dependencies:\n" hacks.patch_flush_during_test_db_creation() failures = 0 if check_app_name is None: app_names = settings.INSTALLED_APPS else: app_names = [check_app_name] for app_name in app_names: app_label = app_name.split(".")[-1] if app_name == 'south': continue try: Migrations(app_name) except (NoMigrations, ImproperlyConfigured): continue app = loading.get_app(app_label) verbosity = int(options.get('verbosity', 1)) if verbosity >= 1: self.stderr.write("processing %s\n" % app_name) old_config = runner.setup_databases() try: call_command('migrate', app_label, noinput=True, verbosity=verbosity) for model in loading.get_models(app): dummy = model._default_manager.exists() except (KeyboardInterrupt, SystemExit): raise except Exception as e: failures += 1 if verbosity >= 1: self.stderr.write(err_msg % app_name) self.stderr.write("%s\n" % e) finally: runner.teardown_databases(old_config) if failures > 0: raise CommandError("Missing depends_on found in %s app(s)." % failures) self.stderr.write("No missing depends_on found.\n")
def runtests(*test_args): if not test_args: test_args = ('djworkflows',) runner = simple.DjangoTestSuiteRunner(failfast=False) failures = runner.run_tests(test_args) sys.exit(failures)
self.assertFalse(self.cache.set('super_big_value', super_big_value)) class PylibmcCacheTests(unittest.TestCase, BaseCacheTests): def setUp(self): self.cache = get_cache('django_pylibmc.memcached.PyLibMCCache') class PylibmcCacheWithBinaryTests(unittest.TestCase, BaseCacheTests): def setUp(self): self.cache = get_cache('django_pylibmc.memcached.PyLibMCCache', BINARY=True) class PylibmcCacheWithOptionsTests(unittest.TestCase, BaseCacheTests): def setUp(self): self.cache = get_cache('django_pylibmc.memcached.PyLibMCCache', OPTIONS={'tcp_nodelay': True, 'ketama': True}) if __name__ == '__main__': runner = simple.DjangoTestSuiteRunner() try: old_config = runner.setup_databases() unittest.main() finally: runner.teardown_databases(old_config) ########NEW FILE########