Django 测试 - South 和 MySQL 的问题

发布于 2024-10-09 19:03:46 字数 1387 浏览 0 评论 0原文

尝试在 django 项目上设置我们的系统以利用 django 的测试框架。但是,当我尝试运行 python manage.py test 时,我收到了下面解释的各种错误。

我们正在开发一个 django 环境,在该环境中,我们使用 reset.bat 批处理文件来重新启动我们的开发服务器并从我们的装置中加载“干净”的数据。除了处理我们的本地环境之外,后台文件还执行以下操作:

Drops and Creates the MySQL Database "testsqldb"

    drop database testsqldb;
    create database testsqldb;

Syncs the database with the models (ignoring anything with South migrations)

    python manage.py syncdb --noinput

Runs the migrations

    python manage.py migrate --no-initial-data

Loads the fixtures

    python manage.py loaddata <fixture1> <fixture2> <fixture3> ...

当我尝试将 InnoDB 引擎设置为默认值运行 python manage.py test 时,我得到:

 ! Error found during real run of migration! Aborting.

 ! Since you have a database that does not support running
 ! schema-altering statements in transactions, we have had
 ! to leave it in an interim state between migrations.

 ! You *might* be able to recover with:

用于撤消创建的表的 SQL 命令是显示“此处”。

 ! The South developers regret this has happened, and would
 ! like to gently persuade you to consider a slightly
 ! easier-to-deal-with DBMS.
 ! NOTE: The error which caused the migration to fail is further up.

当我尝试使用 MyISAM 运行 python manage.py test 时,我收到了有关我们在系统上伪造的表的错误,该表本应在系统运行时创建。

任何有关如何运行测试的想法或想法将不胜感激。

Trying to setup our systems on our django project to utilize django's testing framework. However, when I try running python manage.py test I get various errors explained below.

We're working on a django environment where we use a reset.bat batch file to restart our development servers and load "clean" data from our fixtures. Apart from dealing with our local environment, the back file does the following:

Drops and Creates the MySQL Database "testsqldb"

    drop database testsqldb;
    create database testsqldb;

Syncs the database with the models (ignoring anything with South migrations)

    python manage.py syncdb --noinput

Runs the migrations

    python manage.py migrate --no-initial-data

Loads the fixtures

    python manage.py loaddata <fixture1> <fixture2> <fixture3> ...

When I try to run python manage.py test with the InnoDB Engine set as default, I get:

 ! Error found during real run of migration! Aborting.

 ! Since you have a database that does not support running
 ! schema-altering statements in transactions, we have had
 ! to leave it in an interim state between migrations.

 ! You *might* be able to recover with:

SQL commands to undo tables created are shown "here".

 ! The South developers regret this has happened, and would
 ! like to gently persuade you to consider a slightly
 ! easier-to-deal-with DBMS.
 ! NOTE: The error which caused the migration to fail is further up.

When I try running python manage.py test with MyISAM, I get errors regarding a table that we have faked on our system that is supposed to be created while the system is running.

Any thoughts or ideas regarding how to get the test running would be appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

两人的回忆 2024-10-16 19:03:46

当我尝试使用 MyISAM 运行 python manage.py test 时,我收到了有关我们在系统上伪造的表的错误,该表本应在系统运行时创建。

如果您已经为此创建了一个模型,如果您将 Meta 选项标记为 management=False,也许会有帮助。那么 django 就不会参与创建它了。

When I try running python manage.py test with MyISAM, I get errors regarding a table that we have faked on our system that is supposed to be created while the system is running.

If you have created a model for that, perhaps it would help, if you mark the Meta option as managed=False. Then django wouldn't involve to create it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文