Django 测试 - South 和 MySQL 的问题
尝试在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您已经为此创建了一个模型,如果您将 Meta 选项标记为
management=False
,也许会有帮助。那么 django 就不会参与创建它了。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.