2013-08-26 36 views
1

我遇到過一個問題,我認爲這是Django South,SQLite和測試的問題。我的測試過去在South被引入到應用程序之前工作。我曾經使用內存中的SQLite,一切正常。現在與南我得到一個錯誤,說我的一個數據庫表已經存在,它失敗了。django在加入南後未運行測試

以下是錯誤:

> 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不喜歡測試工具和SQLite嗎?

回答

2

syncdb通過settings.py中指定SOUTH_TESTS_MIGRATE = False創建測試數據庫。從docs報價:

If this is False, South’s test runner integration will make the test database be created using syncdb, rather than via migrations (the default).