【问题标题】:Django Testing - Problems with South and MySQLDjango 测试 - South 和 MySQL 的问题
【发布时间】:2011-06-01 19:40:15
【问题描述】:

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

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

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 时,我收到有关我们在系统上伪造的应该在系统运行时创建的表的错误。

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

【问题讨论】:

    标签: mysql django django-testing django-south


    【解决方案1】:

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

    如果您为此创建了一个模型,将 Meta 选项标记为 managed=False 可能会有所帮助。那么django就不会参与创建它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-11-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-17
      • 2012-04-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多