Пример #1
0
    def _set_template(self):
        verbosity = 0
        old_config = setup_databases(
            verbosity=verbosity, interactive=False
        )
        try:
            if self.settings.database:
                storage = self.settings.database.storage(u'django.fixtures')
            else:
                storage = None

            self.template = best_satisfying_template(
                search_strategy=self.strategy,
                random=Random(),
                condition=self.template_condition,
                settings=self.settings,
                storage=storage,
                max_parameter_tries=1
            )
        finally:
            if django.VERSION[:2] < (1, 9):
                old_names, _ = old_config
            else:
                old_names = old_config

            for connection, old_name, destroy in old_names:
                if destroy:
                    connection.creation.destroy_test_db(
                        old_name, verbosity)
Пример #2
0
    def _set_template(self):
        verbosity = 0
        old_config = setup_databases(verbosity=verbosity, interactive=False)
        try:
            if self.settings.database:
                storage = self.settings.database.storage(u'django.fixtures')
            else:
                storage = None

            self.template = best_satisfying_template(
                search_strategy=self.strategy,
                random=Random(),
                condition=self.template_condition,
                settings=self.settings,
                storage=storage,
                max_parameter_tries=1)
        finally:
            if django.VERSION[:2] < (1, 9):
                old_names, _ = old_config
            else:
                old_names = old_config

            for connection, old_name, destroy in old_names:
                if destroy:
                    connection.creation.destroy_test_db(old_name, verbosity)
Пример #3
0
 def run():
     return best_satisfying_template(
         strat,
         Random(), template_satisfies,
         settings, None
     )