尝试在我们的 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> ...
当我尝试python manage.py test
使用默认设置的 InnoDB 引擎运行时,我得到:
! 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.
当我尝试python manage.py test
使用 MyISAM 运行时,我收到有关我们在系统上伪造的表的错误,该表应该在系统运行时创建。
任何关于如何让测试运行的想法或想法将不胜感激。