testcases.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:django_any_backend 作者: primal100 项目源码 文件源码
def _fixture_setup(self):
        for db_name in self._databases_names(include_mirrors=False):
            # Reset sequences
            if self.reset_sequences:
                self._reset_sequences(db_name)

            # If we need to provide replica initial data from migrated apps,
            # then do so.
            if self.serialized_rollback and hasattr(connections[db_name], "_test_serialized_contents"):
                if self.available_apps is not None:
                    apps.unset_available_apps()
                connections[db_name].creation.deserialize_db_from_string(
                    connections[db_name]._test_serialized_contents
                )
                if self.available_apps is not None:
                    apps.set_available_apps(self.available_apps)

            if self.fixtures:
                # We have to use this slightly awkward syntax due to the fact
                # that we're using *args and **kwargs together.
                call_command('loaddatabulk', *self.fixtures,
                             **{'verbosity': 0, 'database': db_name})
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号