加入南方后,django没有运行测试

时间:2013-08-26 22:59:22

标签: django django-south django-testing django-tests

我遇到了一个问题,我认为这是Django South,SQLite和测试的一个问题。在将South引入应用程序之前,我的测试过去常常有效。我以前使用内存中的SQLite,一切正常。现在有了南方,我得到一个错误,说我的一个数据库表已经存在而且失败了。

这是错误:

> python manage.py test protocols --settings=bionetbook.settings.test
Creating test database for alias 'default'...
/Projects/project/app/venv/lib/python2.7/site-packages/django/db/models/fields/__init__.py:808: RuntimeWarning: DateTimeField received a naive datetime (2013-08-09 00:00:00) while time zone support is active.
  RuntimeWarning)
FATAL ERROR - The following SQL query failed: CREATE TABLE "stuff_stuff" ("id" integer NOT NULL PRIMARY KEY, "created" datetime NOT NULL, "modified" datetime NOT NULL, "user_id" integer NOT NULL, "start" datetime NOT NULL, "name" varchar(255) NOT NULL, "data" text NULL, "slug" varchar(255) NULL);
The error was: table "stuff_stuff" already exists
 ! 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:   = DROP TABLE "stuff_stuff"; []

 ! The South developers regret this has happened, and would
 ! like to gently persuade you to consider a slightly
 ! easier-to-deal-with DBMS (one that supports DDL transactions)
 ! NOTE: The error which caused the migration to fail is further up.
Error in migration: stuff:0003_initial

我是否在试图让这三个一起工作? South不喜欢Test Tools和SQLite吗?

1 个答案:

答案 0 :(得分:2)

syncdb通过在settings.py中指定SOUTH_TESTS_MIGRATE = False来创建测试数据库。引自docs

  

如果这是假的,South的测试运行器集成将进行测试   数据库是使用syncdb创建的,而不是通过迁移(   默认值)。